[AD] shutdown_dialog fix

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Attached is a patch which fixes a bug in shutdown_dialog, following a
report by Tobi Vollebregt in this allegro.cc thread:
http://www.allegro.cc/forums/view_thread.php?_id=473215

-- 
Elias Pschernig
Index: src/gui.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/gui.c,v
retrieving revision 1.72
diff -u -p -r1.72 gui.c
--- src/gui.c	30 Dec 2004 09:27:46 -0000	1.72
+++ src/gui.c	24 Mar 2005 21:11:23 -0000
@@ -361,6 +361,7 @@ int object_message(DIALOG *dialog, int m
 int dialog_message(DIALOG *dialog, int msg, int c, int *obj)
 {
    int count, res, r, force, try;
+   DIALOG *menu_dialog = NULL;
    ASSERT(dialog);
 
    if (msg == MSG_DRAW)
@@ -376,14 +377,16 @@ int dialog_message(DIALOG *dialog, int m
     * first to send the message to the d_menu_proc object and, if the menu
     * is then not active anymore, send it to the other objects as well.
     */
-   if (active_menu_player)
+   if (active_menu_player) {
       try = 2;
+      menu_dialog = active_menu_player->dialog;
+   }
    else
       try = 1;
 
    for (; try > 0; try--) {
       for (count=0; dialog[count].proc; count++) {
-         if ((try == 2) && (&dialog[count] != active_menu_player->dialog))
+         if ((try == 2) && (&dialog[count] != menu_dialog))
 	    continue;
 
 	 if ((force) || (!(dialog[count].flags & D_HIDDEN))) {


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/