aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-03-23 14:44:23 -0500
committerCharles Kerr <charles.kerr@canonical.com>2016-03-23 14:44:23 -0500
commit9f03876ba4aef09f5b93905f90df9a7b9d1073e4 (patch)
tree2217776b9f3d7aaf50112787d9b4a9cbcbc16ad5
parent8f396a525d1353d724b6a96b8a777be2dde35984 (diff)
downloadayatana-indicator-display-9f03876ba4aef09f5b93905f90df9a7b9d1073e4.tar.gz
ayatana-indicator-display-9f03876ba4aef09f5b93905f90df9a7b9d1073e4.tar.bz2
ayatana-indicator-display-9f03876ba4aef09f5b93905f90df9a7b9d1073e4.zip
fix UsbManager dtor issue found by valgrind
-rw-r--r--src/usb-manager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/usb-manager.cpp b/src/usb-manager.cpp
index f67f0e2..4d750c0 100644
--- a/src/usb-manager.cpp
+++ b/src/usb-manager.cpp
@@ -58,6 +58,9 @@ public:
~Impl()
{
+ if (m_restart_idle_tag)
+ g_source_remove(m_restart_idle_tag);
+
clear();
}
@@ -103,7 +106,12 @@ private:
m_req.respond(response);
if (remember_choice && (response == AdbdClient::PKResponse::ALLOW))
write_public_key(m_req.public_key);
- g_idle_add([](gpointer gself){static_cast<Impl*>(gself)->restart(); return G_SOURCE_REMOVE;}, this);
+ m_restart_idle_tag = g_idle_add([](gpointer gself){
+ auto self = static_cast<Impl*>(gself);
+ self->m_restart_idle_tag = 0;
+ self->restart();
+ return G_SOURCE_REMOVE;
+ }, this);
}
));
}
@@ -143,6 +151,8 @@ private:
const std::string m_public_keys_filename;
const std::shared_ptr<UsbMonitor> m_usb_monitor;
const std::shared_ptr<Greeter> m_greeter;
+
+ unsigned int m_restart_idle_tag {};
std::shared_ptr<GAdbdClient> m_adbd_client;
AdbdClient::PKRequest m_req;