Re: Showing a file selection widget in thread-aware program



Hi everyone,

I sent the message below last week but didn't get much response.

I'm still having the same problem having upgraded again to V1.3.15.  If I
initialise gdk_threads the way the documentation says (as far as I can
tell), I can't show a file-selection widget that was created in a
button-callback.

Any ideas what I'm probably doing wrong?
Richard.

----- Original Message -----
From: "Richard Warren" <rew primagraphics co uk>
To: <gtk-app-devel-list gnome org>
Sent: Tuesday, February 19, 2002 1:31 PM
Subject: Showing a file selection widget in thread-aware program


Dear all,

I have just upgraded my GTK development platform from V1.3.9 to V1.3.14
and
am having a slight problem with the file-selection dialog.

Having read the release notes for all the releases in between those two, I
saw from the V1.3.10 release that I now need to call gdk_threads_init() as
well as g_thread_init(NULL) at the start of my program (because I use
threads) so I added it.  I have always called gdk_threads_enter() and
gdk_threads_leave() around my gtk_main() call.  All the documentation I've
read suggests that this should be sufficient.

However, this seems to cause a problem when I later create a
file-selection
widget inside a button-press call-back.  In the call-back, I use
gtk_file_selection_new() to create the widget and then call
gtk_widget_show() to show it.

The problem is that gtk_widget_show() never returns.

If I remove the call to gdk_threads_init() at the start of my program,
everything appears to work okay.

Also, everything is okay if I create a simple modal dialog with
gtk_message_dialog_new() instead of the file-selection dialog.

Am I doing something stupid, or is this a known problem?

When building the libraries, I used
"./configure --with-libiconv --with-threads=posix" for GLIB and simply
"./configure" for everything else (Pango, ATK and GTK+) as I have always
done for previous releases.  Have I missed something?

I am attaching a simple test program which illustrates my problem.

I would be grateful for any suggestions,
Richard Warren.





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