History

Some more memory leaks and codes formatting

atlante45 committed 13 years ago

Commit b03482e1 parent 061199923 files · +145 −91Browse files

Showing the changes to interface/src/Menu.cpp (1 of 23 files). Show all

Unified · Split

interface/src/Menu.cpp+15−4
@@ -413,6 +413,13 @@ Menu::Menu() : · 412 unmodified lines
413413 addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DestructiveAddVoxel);
414414 }
415415
416+Menu::~Menu() {
417+ qDebug("[DEBUG] Menu destructor.\n]");
418+ bandwidthDetailsClosed();
419+ voxelStatsDetailsClosed();
420+ delete _voxelModeActionsGroup;
421+}
422+
416423 void Menu::loadSettings(QSettings* settings) {
417424 if (!settings) {
418425 settings = Application::getInstance()->getSettings();
@@ -855,8 +862,10 @@ void Menu::bandwidthDetails() { · 436 unmodified lines
855862 }
856863
857864 void Menu::bandwidthDetailsClosed() {
858− delete _bandwidthDialog;
859− _bandwidthDialog = NULL;
865+ if (_bandwidthDialog) {
866+ delete _bandwidthDialog;
867+ _bandwidthDialog = NULL;
868+ }
860869 }
861870
862871 void Menu::voxelStatsDetails() {
@@ -870,8 +879,10 @@ void Menu::voxelStatsDetails() { · 7 unmodified lines
870879 }
871880
872881 void Menu::voxelStatsDetailsClosed() {
873− delete _voxelStatsDialog;
874− _voxelStatsDialog = NULL;
882+ if (_voxelStatsDialog) {
883+ delete _voxelStatsDialog;
884+ _voxelStatsDialog = NULL;
885+ }
875886 }
876887
877888 void Menu::cycleFrustumRenderMode() {