Commit 7f7574a 1 parent d0bb5c5 commit 7f7574a Copy full SHA for 7f7574a
File tree 4 files changed +22
-1
lines changed
modules/javafx.graphics/src/main/native-glass/gtk
4 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,8 @@ static gboolean call_runnable (gpointer data)
71
71
javaVM->DetachCurrentThread ();
72
72
}
73
73
74
+ glass_maybe_leave_nested_event_loop ();
75
+
74
76
return FALSE ;
75
77
}
76
78
@@ -304,6 +306,7 @@ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_enterNestedEvent
304
306
(void )env;
305
307
(void )obj;
306
308
309
+ glass_set_leave_nested_event_loop (false );
307
310
gtk_main ();
308
311
}
309
312
@@ -318,7 +321,7 @@ JNIEXPORT void JNICALL Java_com_sun_glass_ui_gtk_GtkApplication_leaveNestedEvent
318
321
(void )env;
319
322
(void )obj;
320
323
321
- gtk_main_quit ( );
324
+ glass_set_leave_nested_event_loop ( true );
322
325
}
323
326
324
327
/*
Original file line number Diff line number Diff line change @@ -97,6 +97,8 @@ static gboolean call_runnable_in_timer
97
97
if (envStatus == JNI_EDETACHED) {
98
98
javaVM->DetachCurrentThread ();
99
99
}
100
+
101
+ glass_maybe_leave_nested_event_loop ();
100
102
}
101
103
return TRUE ;
102
104
}
Original file line number Diff line number Diff line change @@ -462,6 +462,19 @@ gboolean check_and_clear_exception(JNIEnv *env) {
462
462
return FALSE ;
463
463
}
464
464
465
+ static bool should_leave_nested_event_loop = false ;
466
+
467
+ void glass_set_leave_nested_event_loop (bool v) {
468
+ should_leave_nested_event_loop = v;
469
+ }
470
+
471
+ void glass_maybe_leave_nested_event_loop () {
472
+ if (should_leave_nested_event_loop) {
473
+ gtk_main_quit ();
474
+ should_leave_nested_event_loop = false ;
475
+ }
476
+ }
477
+
465
478
// The returned string should be freed with g_free().
466
479
gchar* get_application_name () {
467
480
gchar* ret = NULL ;
Original file line number Diff line number Diff line change @@ -277,6 +277,9 @@ struct jni_exception: public std::exception {
277
277
278
278
#define LOG_EXCEPTION (env ) check_and_clear_exception(env);
279
279
280
+ void glass_set_leave_nested_event_loop (bool v);
281
+ void glass_maybe_leave_nested_event_loop ();
282
+
280
283
gchar* get_application_name ();
281
284
void glass_throw_exception (JNIEnv * env,
282
285
const char * exceptionClass,
You can’t perform that action at this time.
0 commit comments