diff --git a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c index f044364220ca89833eda251c1cd47e0418895142..0c26096e58009cb3852cee3ed4b94865cfa40f6c 100644 --- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c +++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c @@ -42,17 +42,16 @@ static gboolean filenameFilterCallback(const GtkFileFilterInfo * filter_info, gp filename); } -/* - * Class: sun_awt_X11_GtkFileDialogPeer - * Method: quit - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit -(JNIEnv * env, jobject jpeer) +static void quit(gboolean isSignalHandler) { if (dialog != NULL) { - fp_gdk_threads_enter(); + // Callbacks from GTK signals are made within the GTK lock + // So, within a signal handler there is no need to call + // gdk_threads_enter() / fp_gdk_threads_leave() + if (!isSignalHandler) { + fp_gdk_threads_enter(); + } fp_gtk_widget_hide (dialog); fp_gtk_widget_destroy (dialog); @@ -60,10 +59,23 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit fp_gtk_main_quit (); dialog = NULL; - fp_gdk_threads_leave(); + if (!isSignalHandler) { + fp_gdk_threads_leave(); + } } } +/* + * Class: sun_awt_X11_GtkFileDialogPeer + * Method: quit + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit +(JNIEnv * env, jobject jpeer) +{ + quit(FALSE); +} + /** * Convert a GSList to an array of filenames (without the parent folder) */ @@ -147,7 +159,7 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj) jfilenames); fp_g_free(current_folder); - Java_sun_awt_X11_GtkFileDialogPeer_quit(NULL, NULL); + quit(TRUE); } /*