Hi,

 when a menu generated by AG_MenuNew contains a submenu, e.g.
created like this:

    menu = AG_MenuNewGlobal(0);
    AG_MenuNode(menu->root, "Item 1", NULL);
    menuItem = AG_MenuNode(menu->root, "Item 2", NULL);
    {
        subMenuItem = AG_MenuNode(menuItem, "Subitem", NULL);
        AG_MenuAction(subMenuItem, "Subitem Action", NULL, cb, NULL);
    }

 Then it is possible to open the submenu window containing the
"Subitem Action" entry with the window containing the "Subitem" entry
being collapsed.

 This is achieved by opening the "Item 2" menu and then quickly moving
the mouse from the "Subitem" to "Item 1". This is dependent on timing
but can easily be triggered.

 This in itself isn't very beautiful, but when the "Subitem" is then
expanded a second time, the application crashes.

 I also reported this to bugzilla, #174.

 The following change to gui/menu.c fixes the problem for me, but I
didn't spend the time to check whether this was the "right" way to solve
the issue...

--- menu.c  2010-04-15 15:18:09.000000000 +0200
+++ menu.c  2010-10-29 14:23:24.442771835 +0200
@@ -167,6 +167,8 @@
        x += WIDGET(parentWidget)->rView.x1;
        y += WIDGET(parentWidget)->rView.y1;
        winParent = WIDGET(parentWidget)->window;
+       if(!winParent)
+           return(NULL);
    } else {
        m = mi->pmenu;
        winParent = NULL;


Best regards,

 Fabian Svara

_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html

Reply via email to