GTK window and thread
- From: Frederic Beck <frederic beck loria fr>
- To: gtk <gtk-list gnome org>, gtk-app-devel <gtk-app-devel-list gnome org>
- Cc:
- Subject: GTK window and thread
- Date: Mon, 2 May 2005 15:50:55 +0200
Hello
Here's my problem : i have a daemon running in the background, and i
want it to show popups after some events.
I'm new in using GTK, so i took a look at the tutorial, and i managed to
create the window and show it. The popup window is closed when pressing
on a button.
As i don't want this popup to be blocking for the daemon, i wanted to
put it in a thread using pthread.
After a few tries, i managed to make it work, which means, i can show
multiple windows at the same time and close them independently.
To do so, in the function which shows the popup window, i have the
initialisation of the window, and then the following liness :
gtk_main ();
while (gtk_events_pending())
gtk_main_iteration();
and a quit handler is associated to the button and contains :
gtk_main_quit ();
I have 2 questions :
1. When running it works, but i have lots of messages like :
(<unknown>:20080): GLib-WARNING **: g_main_context_check() called
recursively from within a source's check() or prepare() member.
(<unknown>:20080): GLib-WARNING **: g_main_context_prepare() called
recursively from within a source's check() or prepare() member.
2. (more about pthread i guess) i don't want to add a join in my
program, i just want the thread to show the window and stop when the
button is clicked. That's why, after everything is done, i added a
ptrhead_exit(NULL) call, but even after the window has been closed, i
still have processes :
20287 pts/1 Z 0:00 \_ [sh] <defunct>
20292 pts/1 Z 0:00 \_ [sh] <defunct>
20296 pts/1 Z 0:00 \_ [sh] <defunct>
20302 pts/1 Z 0:00 \_ [sh] <defunct>
i have 4 such processes for each window opened. Am i doing something
wrong with GTK or pthread ?
Thanks a lot for your help !
Fred
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]