Re: How to destroy a GtkMenu?

On 03/18/2011 05:06 AM, jcupitt gmail com wrote:
No need to destroy it. Build the menu, keep a pointer to the built
menu around somewhere, and pop it up when you need it.

My Menus are not static. Depending on what you've right-clicked on you get different options.

I need to destroy them.

I think I've managed to simplify it a bit by doing gtk_widget_destroy inside the selection-done event.

If you close the window you built the menu for, you can destroy the
menu in the window's dispose method.

Are you talking about the GdkWindow associated with a popped up GtkMenu or the top-level GtkWindow?


On Thursday, 17 March 2011, Vikram Ambrose<noel ambrose gmail com>  wrote:

     After you have run gtk_menu_popup(), whats
       the proper way of deallocating memory for the menu?

       Currently I'm hooking into the "deactivate" signal, from which I
       call gdk_threads_add_idle, which in turn calls a GSourceFunc that
       just does gtk_widget_destroy. Seems kinda convoluted so I'm
       guessing its probably not the right way.



       static gboolean destroy_(gpointer widget){
         return FALSE;

       static void on_menu_deactivate(GtkWidget *menu, gpointer data){


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