changeset 2306:558959a64772

GTK4: Fix thread safety while using dw_main() and fix an status text issue. This makes GTK4 stable when running multithreaded apps like HandyFTP... Also allows the threading test in dwtest to not cause iter errors.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 10 Feb 2021 07:29:23 +0000
parents 047ad6a5cc1d
children 46e60dca8285
files gtk4/dw.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gtk4/dw.c	Wed Feb 10 04:21:37 2021 +0000
+++ b/gtk4/dw.c	Wed Feb 10 07:29:23 2021 +0000
@@ -1417,7 +1417,11 @@
  */
 void API dw_main(void)
 {
+   pthread_t orig = _dw_thread;
+   
+   _dw_thread = pthread_self();
    g_main_loop_run(_DWMainLoop);
+   _dw_thread = orig;
 }
 
 /*
@@ -3132,7 +3136,7 @@
    g_object_set_data(G_OBJECT(frame), "_dw_label", (gpointer)tmp);
    if(_DWDefaultFont)
       dw_window_set_font(tmp, _DWDefaultFont);
-   DW_FUNCTION_RETURN_THIS(tmp);
+   DW_FUNCTION_RETURN_THIS(frame);
 }
 
 /*