GTK window and thread

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

 



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
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux