Mercurial > dwindows
comparison gtk4/dw.c @ 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 | a9018bd91d04 |
comparison
equal
deleted
inserted
replaced
2305:047ad6a5cc1d | 2306:558959a64772 |
---|---|
1415 /* | 1415 /* |
1416 * Runs a message loop for Dynamic Windows. | 1416 * Runs a message loop for Dynamic Windows. |
1417 */ | 1417 */ |
1418 void API dw_main(void) | 1418 void API dw_main(void) |
1419 { | 1419 { |
1420 pthread_t orig = _dw_thread; | |
1421 | |
1422 _dw_thread = pthread_self(); | |
1420 g_main_loop_run(_DWMainLoop); | 1423 g_main_loop_run(_DWMainLoop); |
1424 _dw_thread = orig; | |
1421 } | 1425 } |
1422 | 1426 |
1423 /* | 1427 /* |
1424 * Causes running dw_main() to return. | 1428 * Causes running dw_main() to return. |
1425 */ | 1429 */ |
3130 gtk_label_set_yalign(GTK_LABEL(tmp), 0.5f); | 3134 gtk_label_set_yalign(GTK_LABEL(tmp), 0.5f); |
3131 g_object_set_data(G_OBJECT(frame), "_dw_id", GINT_TO_POINTER(cid)); | 3135 g_object_set_data(G_OBJECT(frame), "_dw_id", GINT_TO_POINTER(cid)); |
3132 g_object_set_data(G_OBJECT(frame), "_dw_label", (gpointer)tmp); | 3136 g_object_set_data(G_OBJECT(frame), "_dw_label", (gpointer)tmp); |
3133 if(_DWDefaultFont) | 3137 if(_DWDefaultFont) |
3134 dw_window_set_font(tmp, _DWDefaultFont); | 3138 dw_window_set_font(tmp, _DWDefaultFont); |
3135 DW_FUNCTION_RETURN_THIS(tmp); | 3139 DW_FUNCTION_RETURN_THIS(frame); |
3136 } | 3140 } |
3137 | 3141 |
3138 /* | 3142 /* |
3139 * Create a new Multiline Editbox window (widget) to be packed. | 3143 * Create a new Multiline Editbox window (widget) to be packed. |
3140 * Parameters: | 3144 * Parameters: |