Merge lp:~saviq/unity-2d/fix-panel-leak into lp:unity-2d

Proposed by Michał Sawicz
Status: Merged
Approved by: Florian Boucault
Approved revision: 727
Merged at revision: 727
Proposed branch: lp:~saviq/unity-2d/fix-panel-leak
Merge into: lp:unity-2d
Diff against target: 35 lines (+7/-0)
2 files modified
panel/applets/appname/menubarwidget.cpp (+6/-0)
panel/applets/appname/menubarwidget.h (+1/-0)
To merge this branch: bzr merge lp:~saviq/unity-2d/fix-panel-leak
Reviewer Review Type Date Requested Status
Florian Boucault (community) Needs Fixing
Review via email: mp+75744@code.launchpad.net

Commit message

[panel] destroy entries removed from MenuBarWidget

Free memory used by the entries.
Fixes https://bugs.launchpad.net/unity-2d/+bug/850320
Kudos to @fboucault.

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

the delete needs to happen in the destructor of MenuBarWidget as well. Using qDeleteAll should do.

review: Needs Fixing
lp:~saviq/unity-2d/fix-panel-leak updated
727. By Michał Sawicz

[panel] destroy the list of widget upon MenuBarWidget destruction

Revision history for this message
Michał Sawicz (saviq) wrote :

Done.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/applets/appname/menubarwidget.cpp'
2--- panel/applets/appname/menubarwidget.cpp 2011-09-09 02:23:30 +0000
3+++ panel/applets/appname/menubarwidget.cpp 2011-09-16 14:54:26 +0000
4@@ -54,6 +54,11 @@
5 m_layout->addStretch();
6 }
7
8+MenuBarWidget::~MenuBarWidget()
9+{
10+ qDeleteAll(m_widgetList);
11+}
12+
13 bool MenuBarWidget::isEmpty() const
14 {
15 return m_isEmpty;
16@@ -117,6 +122,7 @@
17 m_layout->removeWidget(widget);
18 m_indicatorsManager->removeIndicatorEntryWidget(widget);
19 m_widgetList.removeOne(widget);
20+ delete widget;
21 updateIsEmpty();
22 break;
23 }
24
25=== modified file 'panel/applets/appname/menubarwidget.h'
26--- panel/applets/appname/menubarwidget.h 2011-09-09 02:23:30 +0000
27+++ panel/applets/appname/menubarwidget.h 2011-09-16 14:54:26 +0000
28@@ -41,6 +41,7 @@
29 Q_OBJECT
30 public:
31 MenuBarWidget(IndicatorsManager*, QWidget* parent = 0);
32+ ~MenuBarWidget();
33
34 bool isEmpty() const;
35 bool isOpened() const;

Subscribers

People subscribed via source and target branches