@@ -2473,6 +2473,7 @@ Exec_stat MCStack::openrect(const MCRectangle &rel, Window_mode wm, MCStack *par
24732473 // MW-2011-01-12: [[ Bug 9282 ]] Set to true if the props need restoring.
24742474 bool t_restore_props;
24752475
2476+ Exec_stat t_stat = ES_NORMAL;
24762477 if (opened && flags & F_VISIBLE)
24772478 {
24782479 // MW-2011-08-19: [[ Redraw ]] Set the update region to everything.
@@ -2522,22 +2523,40 @@ Exec_stat MCStack::openrect(const MCRectangle &rel, Window_mode wm, MCStack *par
25222523 // If opening the dialog failed for some reason, this will return false.
25232524 if (mode_openasdialog ())
25242525 {
2525- while (opened && (mode == WM_MODAL || mode == WM_SHEET) && !MCquit)
2526+ while (opened &&
2527+ (mode == WM_MODAL || mode == WM_SHEET) &&
2528+ !MCquit &&
2529+ !MCabortscript)
25262530 {
25272531 MCU_resetprops (True);
25282532 // MW-2011-09-08: [[ Redraw ]] Make sure we flush any updates.
25292533 MCRedrawUpdateScreen ();
25302534 MCscreen->siguser ();
2531- MCscreen->wait (REFRESH_INTERVAL, True, True);
2535+ if (MCscreen->wait (REFRESH_INTERVAL, True, True))
2536+ {
2537+ MCeerror->add (EE_WAIT_ABORT, 0 , 0 );
2538+ t_stat = ES_ERROR;
2539+ break ;
2540+ }
25322541 }
25332542 mode_closeasdialog ();
25342543 if (MCquit)
25352544 MCabortscript = False;
25362545 }
25372546
2538- // Make sure the mode is reset to closed so dialogs can be reopened.
2539- mode = WM_CLOSED;
2540-
2547+ // If there was no error, make sure the mode is reset to closed so
2548+ // it can be reopened. Otherwise, do the equivalent of 'close this
2549+ // stack'.
2550+ if (t_stat != ES_ERROR)
2551+ {
2552+ mode = WM_CLOSED;
2553+ }
2554+ else
2555+ {
2556+ close ();
2557+ checkdestroy ();
2558+ }
2559+
25412560 t_restore_props = true ;
25422561 }
25432562 else
@@ -2572,7 +2591,8 @@ Exec_stat MCStack::openrect(const MCRectangle &rel, Window_mode wm, MCStack *par
25722591 }
25732592 if (reopening)
25742593 MClockmessages = oldlock;
2575- return ES_NORMAL;
2594+
2595+ return t_stat;
25762596
25772597
25782598}
0 commit comments