# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1070390427 0 # Node ID edcf9ec12f8cbd11bd75c67b08bb330f0fcd24f5 # Parent 84e471a4ec7ec62f9d7a514bcf9ca8f681045f18 Fixed a bug in the dialog system on Unix where, gtk_main() could exit when dw_dialog_wait() and dw_dialog_dismiss() were called from different threads. diff -r 84e471a4ec7e -r edcf9ec12f8c dw.h --- a/dw.h Mon Nov 24 18:53:07 2003 +0000 +++ b/dw.h Tue Dec 02 18:40:27 2003 +0000 @@ -797,6 +797,7 @@ typedef struct _dwdialog { HEV eve; int done; + int method; void *data, *result; } DWDialog; diff -r 84e471a4ec7e -r edcf9ec12f8c gtk/dw.c --- a/gtk/dw.c Mon Nov 24 18:53:07 2003 +0000 +++ b/gtk/dw.c Tue Dec 02 18:40:27 2003 +0000 @@ -1099,6 +1099,7 @@ dw_event_reset(tmp->eve); tmp->data = data; tmp->done = FALSE; + tmp->method = FALSE; tmp->result = NULL; return tmp; @@ -1114,7 +1115,7 @@ int dw_dialog_dismiss(DWDialog *dialog, void *result) { dialog->result = result; - if(pthread_self() == _dw_thread || _dw_thread == (pthread_t)-1) + if(dialog->method) gtk_main_quit(); else dw_event_post(dialog->eve); @@ -1142,9 +1143,15 @@ } if(pthread_self() == _dw_thread) + { + dialog->method = TRUE; gtk_main(); + } else + { + dialog->method = FALSE; dw_event_wait(dialog->eve, -1); + } if(newprocess) {