[maemo-developers] Runtime exception in Multithreading N800
From: Richard Pickler rpickler at gmail.comDate: Tue Mar 25 00:45:28 EET 2008
- Previous message: Runtime exception in Multithreading N800
- Next message: Python and Hildon: Toolbar and window title remain hidden
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This little document got me through some rough nights when trying to multithread my gtk app. http://research.operationaldynamics.com/blogs/andrew/software/gnome-desktop/gtk-thread-awareness.html Don't remember where I first came across it, but I owe that man a beer. On Sun, Mar 23, 2008 at 6:54 AM, Chris Lord <chris at openedhand.com> wrote: > On Sat, 2008-03-22 at 11:49 -0500, nisha jain wrote: > > Hi All, > > > > I have used pthread in my application and Hildon APIs for the GUI. > > > > In my application the main() is used for the GUI and pthread for > > communication. > > > > I am getting following run time exception some times while running > > number of times... > > > > Though i am not able to identify the cause... > > > > > > N800App[2455]: GLIB CRITICAL ** Gtk - gtk_box_pack_start: assertion > > `child->parent == NULL' failed > > > > Please let me know if some one has any idea about it? > > You'd get this error when trying to pack a widget into a Gtk[VH]Box when > that widget is already contained (i.e. it has a parent). To re-pack a > widget, you need to g_object_ref it, (assuming you don't hold a > reference), remove it from its container (gtk_container_remove) and then > you'll be able to pack it into the box successfully (remember to unref > afterwards). > > Also note, GTK is not thread-safe, so GTK functions mustn't be called > outside of the main thread. You can use gdk_threads_enter/leave, but > it's generally easier to use idle callbacks (if you g_idle_add in a > thread, the callback will happen in the thread of the mainloop, as > opposed to whatever thread you called it from). > > Hope that helps! > > --Chris > > > > > > _______________________________________________ > maemo-developers mailing list > maemo-developers at maemo.org > https://lists.maemo.org/mailman/listinfo/maemo-developers >
- Previous message: Runtime exception in Multithreading N800
- Next message: Python and Hildon: Toolbar and window title remain hidden
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]