Mercurial > dwindows
changeset 494:edcf9ec12f8c
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.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 02 Dec 2003 18:40:27 +0000 |
parents | 84e471a4ec7e |
children | 477de19f14af |
files | dw.h gtk/dw.c |
diffstat | 2 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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) {