[glom/gmenu] gmenu: Do not leak the Gtk::Menu*



commit bd4f0667750e4571eea53ac7fe7da99ebc859841
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Sep 26 21:23:26 2013 +0200

    gmenu: Do not leak the Gtk::Menu*

 glom/appwindow.cc                                  |    2 +-
 glom/mode_data/box_data_calendar_related.cc        |    2 +-
 glom/mode_data/db_adddel/db_adddel.cc              |    2 +-
 .../print_layouts/window_print_layout_edit.cc      |    4 ++--
 .../dialog_relationships_overview.cc               |    4 ++--
 glom/print_layout/canvas_print_layout.cc           |    2 +-
 glom/utility_widgets/adddel/adddel.cc              |    2 +-
 .../utility_widgets/canvas/test_canvas_editable.cc |    2 +-
 glom/utility_widgets/imageglom.cc                  |    2 +-
 glom/utility_widgets/layoutwidgetmenu.cc           |    2 +-
 glom/utility_widgets/layoutwidgetutils.cc          |    2 +-
 glom/utility_widgets/notebooklabelglom.cc          |    2 +-
 12 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/glom/appwindow.cc b/glom/appwindow.cc
index db2367c..3cf9522 100644
--- a/glom/appwindow.cc
+++ b/glom/appwindow.cc
@@ -112,7 +112,7 @@ AppWindow::AppWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
   if(!gmenu)
     g_warning("GMenu not found");
 
-  m_menubar = new Gtk::MenuBar(gmenu);
+  m_menubar = Gtk::manage(new Gtk::MenuBar(gmenu));
   m_menubar->show();
   m_pBoxTop->pack_start(*m_menubar, Gtk::PACK_SHRINK);
 
diff --git a/glom/mode_data/box_data_calendar_related.cc b/glom/mode_data/box_data_calendar_related.cc
index 8acf47a..4e8dff4 100644
--- a/glom/mode_data/box_data_calendar_related.cc
+++ b/glom/mode_data/box_data_calendar_related.cc
@@ -527,7 +527,7 @@ void Box_Data_Calendar_Related::setup_menu(Gtk::Widget* /* this */)
   menu->append(_("_Edit"), "context.edit");
   menu->append(_("_Layout"), "context.layout");
 
-  m_pMenuPopup = new Gtk::Menu(menu);
+  m_pMenuPopup = Gtk::manage(new Gtk::Menu(menu));
   m_pMenuPopup->attach_to_widget(*this);
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 3950b7f..e418f87 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -264,7 +264,7 @@ void DbAddDel::setup_menu(Gtk::Widget* /* widget */)
   menu->append(_("_Layout"), "context.layout");
 #endif
 
-  m_pMenuPopup = new Gtk::Menu(menu);
+  m_pMenuPopup = Gtk::manage(new Gtk::Menu(menu));
   m_pMenuPopup->attach_to_widget(*this);
 
   if(get_allow_user_actions())
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc 
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 66dcabf..6d3992d 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -278,7 +278,7 @@ void Window_PrintLayout_Edit::init_menu()
     g_warning("GMenu not found");
 
   //Menubar:
-  Gtk::MenuBar* pMenuBar = new Gtk::MenuBar(gmenu);
+  Gtk::MenuBar* pMenuBar = Gtk::manage(new Gtk::MenuBar(gmenu));
   m_box_menu->pack_start(*pMenuBar, Gtk::PACK_SHRINK);
   pMenuBar->show();
 
@@ -705,7 +705,7 @@ void Window_PrintLayout_Edit::setup_context_menu()
   if(!gmenu)
     g_warning("GMenu not found");
 
-  m_context_menu = new Gtk::Menu(gmenu);
+  m_context_menu = Gtk::manage(new Gtk::Menu(gmenu));
   m_context_menu->attach_to_widget(*this);
 }
 
diff --git a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc 
b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
index 0d0b6b0..930c1ea 100644
--- a/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/dialog_relationships_overview.cc
@@ -78,7 +78,7 @@ Dialog_RelationshipsOverview::Dialog_RelationshipsOverview(BaseObjectType* cobje
   if(!gmenu)
     g_warning("GMenu not found");
 
-  m_menu = new Gtk::MenuBar(gmenu);
+  m_menu = Gtk::manage(new Gtk::MenuBar(gmenu));
 
   vbox->pack_start(*m_menu, Gtk::PACK_SHRINK);
   m_menu->show();
@@ -472,7 +472,7 @@ void Dialog_RelationshipsOverview::setup_context_menu()
   if(!gmenu)
     g_warning("GMenu not found");
 
-  m_context_menu = new Gtk::Menu(gmenu);
+  m_context_menu = Gtk::manage(new Gtk::Menu(gmenu));
   m_context_menu->attach_to_widget(*this);
 }
 
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index d42b4f9..542bb9c 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -292,7 +292,7 @@ void Canvas_PrintLayout::setup_context_menu()
   menu->append(_("_Edit"), "context.edit");
   menu->append(_("_Formatting"), "context.formatting");
   menu->append(_("_Delete"), "context.delete");
-  m_context_menu = new Gtk::Menu(menu);
+  m_context_menu = Gtk::manage(new Gtk::Menu(menu));
   m_context_menu->attach_to_widget(*this);
 }
 
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index c4269e2..e29e491 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -250,7 +250,7 @@ void AddDel::setup_menu(Gtk::Widget* /* widget */)
   menu->append(_("_Edit"), "context.edit");
   menu->append(_("_Delete"), "context.delete");
 
-  m_pMenuPopup = new Gtk::Menu(menu);
+  m_pMenuPopup = Gtk::manage(new Gtk::Menu(menu));
   m_pMenuPopup->attach_to_widget(*this);
 }
 
diff --git a/glom/utility_widgets/canvas/test_canvas_editable.cc 
b/glom/utility_widgets/canvas/test_canvas_editable.cc
index d1390c9..0f70fce 100644
--- a/glom/utility_widgets/canvas/test_canvas_editable.cc
+++ b/glom/utility_widgets/canvas/test_canvas_editable.cc
@@ -184,7 +184,7 @@ private:
     menu->append(_("_Delete"), "context.delete");
     
     //Get the menu:
-    m_context_menu = new Gtk::Menu(menu); 
+    m_context_menu = Gtk::manage(new Gtk::Menu(menu)); 
     m_context_menu->attach_to_widget(*this);
   }
  
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index d98d612..10183dc 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -960,7 +960,7 @@ void ImageGlom::setup_menu_usermode()
   menu->append(_("_Paste"), "context.paste");
   menu->append(_("_Clear"), "context.clear");
 
-  m_pMenuPopup_UserMode = new Gtk::Menu(menu);
+  m_pMenuPopup_UserMode = Gtk::manage(new Gtk::Menu(menu));
   m_pMenuPopup_UserMode->attach_to_widget(*this);
 }
 
diff --git a/glom/utility_widgets/layoutwidgetmenu.cc b/glom/utility_widgets/layoutwidgetmenu.cc
index e56c764..3e6bc62 100644
--- a/glom/utility_widgets/layoutwidgetmenu.cc
+++ b/glom/utility_widgets/layoutwidgetmenu.cc
@@ -126,7 +126,7 @@ void LayoutWidgetMenu::setup_menu(Gtk::Widget* widget)
   menu->append(_("Delete"), "context.delete");
 
 
-  m_pMenuPopup = new Gtk::Menu(menu);
+  m_pMenuPopup = Gtk::manage(new Gtk::Menu(menu));
   m_pMenuPopup->attach_to_widget(*widget);
 
   if(pApp)
diff --git a/glom/utility_widgets/layoutwidgetutils.cc b/glom/utility_widgets/layoutwidgetutils.cc
index f95f23e..4c693e5 100644
--- a/glom/utility_widgets/layoutwidgetutils.cc
+++ b/glom/utility_widgets/layoutwidgetutils.cc
@@ -58,7 +58,7 @@ void LayoutWidgetUtils::setup_util_menu(Gtk::Widget* widget)
   menu->append(_("Properties"), "context.properties");
   menu->append(_("_Delete"), "context.delete");
 
-  m_pPopupMenuUtils = new Gtk::Menu(menu);
+  m_pPopupMenuUtils = Gtk::manage(new Gtk::Menu(menu));
   m_pPopupMenuUtils->attach_to_widget(*widget);
 #endif
 }
diff --git a/glom/utility_widgets/notebooklabelglom.cc b/glom/utility_widgets/notebooklabelglom.cc
index 649507d..1424928 100644
--- a/glom/utility_widgets/notebooklabelglom.cc
+++ b/glom/utility_widgets/notebooklabelglom.cc
@@ -124,7 +124,7 @@ void NotebookLabel::setup_menu(Gtk::Widget* /* widget */)
   menu->append(_("New Group"), "context.new-group");
   menu->append(_("_Delete"), "context.delete");
 
-  m_pPopupMenu = new Gtk::Menu(menu);
+  m_pPopupMenu = Gtk::manage(new Gtk::Menu(menu));
   m_pPopupMenu->attach_to_widget(*this);
 }
 


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