mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
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.
This commit is contained in:
parent
12a415f077
commit
7b96fa1c5e
10 changed files with 34 additions and 12 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include <gtkmm/menu.h>
|
||||
#include <gtkmm/menuitem.h>
|
||||
|
||||
#include "ardour_ui.h"
|
||||
#include "time_axis_view.h"
|
||||
#include "streamview.h"
|
||||
#include "editor_summary.h"
|
||||
|
|
@ -461,7 +462,7 @@ EditorSummary::on_button_press_event (GdkEventButton* ev)
|
|||
|
||||
if (ev->button == 3) { // right-click: show the reset menu action
|
||||
using namespace Gtk::Menu_Helpers;
|
||||
Gtk::Menu* m = manage (new Gtk::Menu);
|
||||
Gtk::Menu* m = ARDOUR_UI::instance()->shared_popup_menu ();
|
||||
MenuList& items = m->items ();
|
||||
items.push_back(MenuElem(_("Reset Summary to Extents"),
|
||||
sigc::mem_fun(*this, &EditorSummary::reset_to_extents)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue