From 2efc2f1f60db98ea7f6adb8f201d54cdfc653e5c Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Fri, 27 Aug 2004 21:17:54 +0000 Subject: [PATCH] make sure that function doesn't return while structure is holding pointer to a stack variable. Also, simplify logic. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10234 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/gnome-utils/dialog-transfer.c | 47 +++++++++++++++---------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/src/gnome-utils/dialog-transfer.c b/src/gnome-utils/dialog-transfer.c index d5f3466d64..1d77a6204e 100644 --- a/src/gnome-utils/dialog-transfer.c +++ b/src/gnome-utils/dialog-transfer.c @@ -2073,32 +2073,31 @@ gboolean gnc_xfer_dialog_run_until_done( XferDialog *xferData ) { gboolean result_ok = FALSE; - if( xferData ) - { - xferData->result_p = &result_ok; - while( TRUE ) - { - gnome_dialog_run( GNOME_DIALOG(xferData->dialog) ); - - /* See if the dialog is still there. For various reasons, the - * user could have hit OK but remained in the dialog. We don't - * want to return processing back to anyone else until we clear - * off this dialog, so if the dialog is still there we'll just - * run it again. - */ + if( NULL == xferData ) return FALSE; - DEBUG("find component"); - if( !gnc_find_first_gui_component( DIALOG_TRANSFER_CM_CLASS, - find_xfer, xferData ) ) - { - /* no more dialog, and OK was clicked, so assume it's all good */ - return( result_ok ); - } - /* else run the dialog again */ - } + xferData->result_p = &result_ok; + while( TRUE ) + { + gnome_dialog_run( GNOME_DIALOG(xferData->dialog) ); + + /* See if the dialog is still there. For various reasons, the + * user could have hit OK but remained in the dialog. We don't + * want to return processing back to anyone else until we clear + * off this dialog, so if the dialog is still there we'll just + * run it again. + */ + + DEBUG("find component"); + if( !gnc_find_first_gui_component( DIALOG_TRANSFER_CM_CLASS, + find_xfer, xferData ) ) + { + /* no more dialog, and OK was clicked, so assume it's all good */ + xferData->result_p = NULL; + return( result_ok ); + } + /* else run the dialog again */ } - - return( FALSE ); + return FALSE; }