How to clear pending events?

Good day,

I have 2 threads:
DATA - to read data from DB
GUI - to display data

Glib::Dispatcher is used to send updates from DATA thread to GUI.

At some time I would to switch environment, so, I am destroying all
forms (GUI-objects) already displayed, and giving user "login" dialog.

When GUI-objects are destroyed, Glib::Dispatcher notifiers are destroyed
as well, but it happens before MAIN-LOOP actually reads all events those
were stored by notifiers. So, application crashes, when trying to access
data from Glib::DispatchNotifier structure.

1) My class that contain Glib::Dispatcher object is derived from
sigc::trackable, so, I hoped it should handle signal disconnection
properly on destruction.

2) (GTK+) Is there way to clear events manually to prevent application
from crashing?

That backtrace I've got from debuggin:

#0  0x0000003b70e535e9 in std::_List_node_base::swap () from /usr/lib64/
#1  0x0000002a96c66136 in Glib::DispatchNotifier::pipe_io_handler (this=0x5baec0)
    at /usr/lib/gcc/x86_64-redhat-linux/3.4.5/../../../../include/c++/3.4.5/bits/stl_list.h:913
#2  0x0000002a96c66b00 in sigc::internal::slot_call1<sigc::bound_mem_functor1<bool, Glib::DispatchNotifier, Glib::IOCondition>, bool, Glib::IOCondition>::call_it (rep=Variable "rep" is not available.
) at /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1839
#3  0x0000002a96c69b01 in Glib::IOSource::dispatch (this=Variable "this" is not available.
) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:515
#4  0x0000002a96c68edf in Glib::Source::dispatch_vfunc (callback=Variable "callback" is not available.
) at
#5  0x0000002a974850f6 in IA__g_main_context_dispatch (context=0x57d6b0) at gmain.c:1934
#6  0x0000002a97486b18 in g_main_context_iterate (context=0x57d6b0, block=1847316864, dispatch=1, self=Variable "self" is not available.
) at gmain.c:2565
#7  0x0000002a97486e7a in IA__g_main_loop_run (loop=0x8c1580) at gmain.c:2769
#8  0x0000002a96842201 in gtk_main () at gtkmain.c:1173
#9  0x000000000040537d in main (argc=1, argv=0x7fbffff398) at Client.cpp:361

package versions:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]