From 7b96fa1c5e99e054f43ca3272d21ae955bfa3443 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 7 Mar 2019 17:02:12 +0100 Subject: Fix some Gtk::Menu memory leaks A Gtk::manage()d widget will be deleted when its parent container is destroyed. Top-level context menus are not inside a container and hence need to be manually deallocated. The solution here is to use a shared Gtk::Menu pointer that is centrally de/re-allocated. This works because the GUI is single-threaded and at most one context menu is visible at a time. --- gtk2_ardour/mixer_strip.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour/mixer_strip.cc') diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 736e757675..052f08204e 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -59,6 +59,7 @@ #include "widgets/tooltips.h" +#include "ardour_ui.h" #include "ardour_window.h" #include "enums_convert.h" #include "mixer_strip.h" @@ -2520,7 +2521,7 @@ MixerStrip::popup_level_meter_menu (GdkEventButton* ev) { using namespace Gtk::Menu_Helpers; - Gtk::Menu* m = manage (new Menu); + Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu (); MenuList& items = m->items (); RadioMenuItem::Group group; -- cgit v1.2.3