Re: create a popup window from thread



Thanks.

I thought I don't need to put any gdk_thread_enter() and gdk_thread_leav() as long as I use main thread to 
update the GUI. I use the async queue. In the main thread, I have callback function like

void popup_dialog(GtkWidget *image, gboolean result)
{
       gtk_widget_show(dialog_done);
       gdk_flush();
}

The other thread put data to the queue,

       event_data->callback = popup_dialog;
       g_async_queue_push(thread_events_queue, event_data);
       g_main_context_wakeup(NULL);

I tried adding gdk_thread_enter() and gdk_thread_leave() beside gtk_main(). But it didn't help. I also tried 
adding

while (gtk_events_pending ())
 gtk_main_iteration ();

into main thread and the other thread. It didn't work either.

Any idea? It does look like locking problem. The dialog has frame only, withou any text or button.





------ Original Message ------
From: Jan-Marek Glogowski <glogow fbihome de>
Date: Friday, January 14th, 2005 7:28 PM SGT
To: Liu Hai Bin <haibin resolvo com>
Subject: Re: create a popup window from thread

Hi

You have GDK locking problems.

See GDK Reference Manual -> Threads.

And

while (gtk_events_pending ())
 gtk_main_iteration ();

HTH

Jan-Marek




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