Re: Destroying a menu



Iago Rubio
On Wed, 2008-01-23 at 12:47 +0100, Jerome Blondel wrote:
On Mon, 2008-01-21 at 10:47 +0100, Jerome Blondel wrote:
Even when the ref count of the submenu is increased, the program still crashes on the second time the submenu is popped up. It seems the destruction of the container has other side-effects.
[snip]
            s->popup_stars = gtk_menu_new();
            for (k = selected_stars; k != NULL; k = k->next)
            {
[snip]
                stars = gtk_menu_item_new_with_label(str);
[snip]
gtk_menu_shell_append(GTK_MENU_SHELL(s->popup_stars), stars); gtk_menu_item_set_submenu(GTK_MENU_ITEM(stars), s->popup_actions);

You can not add the same menu as submenu for various menu items.

As long as you attach the menu to one item, it's detached from the
previous one.

If I recreate the submenu for each new instance of the menu, and reuse it for all menu items, nothing obvious happens, as the GUI still works, despite the GTK warning.

On the other hand, if I try to reuse the same submenu for all menu instances, it crashes even if there is only one menu item (putting a break in the loop).

You need here a function to create the same submenu for every menu item.

I'll do that.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]