interesting thread problem


I've just managed to convert my app to use a separate worker thread. I
think it was worth it, but it wasn't trouble free. I thought I'd share
one problem with the list because it had me baffled for a while, though
I've worked around it now. It might also count as a bug, though I'm not

I had a GnomePropertyBox, which contained a bunch of widgets. Whenever I
closed the box (even without doing anything) the program would hang.
This was because
the widgets attached themselves to the propertybox with the code:

gtk_object_set_data_full(GTK_OBJECT(propertybox), "name", widget,
(GtkDestroyNotify) gtk_widget_unref);

The problem was that the propertybox, as it destroys itself, calls
g_datalist_clear(). That acquires the gdk mutex, then (a few calls down)
calls g_datalist_clear() again, and promptly hangs while trying to
acquire the mutex.

Anyway, the workaround was to use

gtk_object_set_data(GTK_OBJECT(propertybox), "name", widget);



Edwin Young

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