diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-24 08:44:48 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2015-08-24 08:44:48 +0200 |
commit | 6319cc457adf63c55920963a7a7cbb1398b8bbac (patch) | |
tree | 72eeda41d9aa9ac84bba5ff5af4da11114b7d0b5 /facetracknoir/ui.cpp | |
parent | 1b8a80c2694c025ecf2a3bd0d1c0a934f91451ec (diff) |
ui: avoid potential memory leak
While not having tested with valgrind, setMenu() doesn't seem to take
ownership of QMenu. Ensure it's not leaked.
Diffstat (limited to 'facetracknoir/ui.cpp')
-rw-r--r-- | facetracknoir/ui.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp index e22fee7a..bd1b88f7 100644 --- a/facetracknoir/ui.cpp +++ b/facetracknoir/ui.cpp @@ -12,7 +12,6 @@ #include "facetracknoir/new_file_dialog.h" #include <QFileDialog> #include <QDesktopServices> -#include <QMenu> #ifndef _WIN32 # include <unistd.h> @@ -74,12 +73,11 @@ MainWindow::MainWindow() : connect(&pose_update_timer, SIGNAL(timeout()), this, SLOT(showHeadPose())); connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit())); - auto menu = new QMenu; - menu->addAction("Create new empty config", this, SLOT(make_empty_config())); - menu->addAction("Create new copied config", this, SLOT(make_copied_config())); - menu->addAction("Open configuration directory", this, SLOT(open_config_directory())); - menu->addAction("Refresh configuration list", this, SLOT(refresh_config_list())); - ui.profile_button->setMenu(menu); + profile_menu.addAction("Create new empty config", this, SLOT(make_empty_config())); + profile_menu.addAction("Create new copied config", this, SLOT(make_copied_config())); + profile_menu.addAction("Open configuration directory", this, SLOT(open_config_directory())); + profile_menu.addAction("Refresh configuration list", this, SLOT(refresh_config_list())); + ui.profile_button->setMenu(&profile_menu); kbd_quit.setEnabled(true); |