This is for everyone who can reproduce the bug. Could you build a libcwidget3 with the attached patch and see what's produced in /tmp/cwidget.input.log when you reproduce the bug? If I start aptitude, run dpkg once, and exit, I get this:
Starting input thread Creating new input thread Input thread created Stopping input thread Destroying existing input thread Input thread destroyed Starting input thread Creating new input thread Input thread created Stopping input thread Destroying existing input thread Input thread destroyed Daniel
diff --git a/src/cwidget/toplevel.cc b/src/cwidget/toplevel.cc index 7cfd048..486fb00 100644 --- a/src/cwidget/toplevel.cc +++ b/src/cwidget/toplevel.cc @@ -58,6 +58,8 @@ #include <fcntl.h> #include <sys/types.h> +#include <fstream> + namespace cwidget { std::string version() @@ -425,22 +427,34 @@ namespace cwidget public: static void start() { + std::ofstream out("/tmp/cwidget.input.log", std::ios::app); + out << "Starting input thread" << std::endl; + threads::mutex::lock l(instance_mutex); if(instancet == NULL) - instancet = new threads::thread(threads::make_bootstrap_proxy(&instance)); + { + out << "Creating new input thread" << std::endl; + instancet = new threads::thread(threads::make_bootstrap_proxy(&instance)); + out << "Input thread created" << std::endl; + } } static void stop() { + std::ofstream out("/tmp/cwidget.input.log", std::ios::app); + out << "Stopping input thread" << std::endl; + threads::mutex::lock l(instance_mutex); if(instancet != NULL) { + out << "Destroying existing input thread" << std::endl; instancet->cancel(); instancet->join(); delete instancet; instancet = NULL; + out << "Input thread destroyed" << std::endl; } }