From b75b89e99973b25db23d448703135e68472b88c6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 13 Oct 2010 21:15:31 +0200 Subject: Fix mem leak, due to kbookmarkmenu class. Please, see http://svn.reviewboard.kde.org/r/5606/ about. --- src/bookmarks/bookmarkprovider.cpp | 11 +++++++---- src/bookmarks/bookmarkprovider.h | 6 ++++-- src/bookmarks/bookmarkstoolbar.cpp | 1 + src/bookmarks/bookmarkstoolbar.h | 3 +++ 4 files changed, 15 insertions(+), 6 deletions(-) (limited to 'src/bookmarks') diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index beca5475..ccdc3269 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -97,6 +97,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent) BookmarkProvider::~BookmarkProvider() { + qDeleteAll(m_bookmarkMenus); delete m_manager; } @@ -109,8 +110,9 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent) KActionMenu *bookmarkActionMenu = new KActionMenu(menu); bookmarkActionMenu->setMenu(menu); bookmarkActionMenu->setText(i18n("&Bookmarks")); - new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection); - + BookmarkMenu *bMenu = new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection); + m_bookmarkMenus.append(bMenu); + kDebug() << "new Bookmarks menu... DONE"; return bookmarkActionMenu; @@ -222,8 +224,9 @@ void BookmarkProvider::fillBookmarkBar(BookmarkToolBar *toolBar) { KBookmarkActionMenu *menuAction = new KBookmarkActionMenu(bookmark.toGroup(), this); menuAction->setDelayed(false); - new BookmarkMenu(bookmarkManager(), bookmarkOwner(), menuAction->menu(), bookmark.address()); - + BookmarkMenu *bMenu = new BookmarkMenu(bookmarkManager(), bookmarkOwner(), menuAction->menu(), bookmark.address()); + m_bookmarkMenus.append(bMenu); + connect(menuAction->menu(), SIGNAL(aboutToShow()), toolBar, SLOT(menuDisplayed())); connect(menuAction->menu(), SIGNAL(aboutToHide()), toolBar, SLOT(menuHidden())); diff --git a/src/bookmarks/bookmarkprovider.h b/src/bookmarks/bookmarkprovider.h index 3f7a5c52..9089441d 100644 --- a/src/bookmarks/bookmarkprovider.h +++ b/src/bookmarks/bookmarkprovider.h @@ -41,6 +41,7 @@ class BookmarksPanel; class BookmarkToolBar; class BookmarkOwner; +class BookmarkMenu; class KAction; class KActionCollection; @@ -143,8 +144,9 @@ private: KBookmarkManager *m_manager; BookmarkOwner *m_owner; KActionCollection *m_actionCollection; - QList m_bookmarkToolBars; - QList m_bookmarkPanels; + QList m_bookmarkToolBars; + QList m_bookmarkPanels; + QList m_bookmarkMenus; }; diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp index 60b59a3f..33ea296e 100644 --- a/src/bookmarks/bookmarkstoolbar.cpp +++ b/src/bookmarks/bookmarkstoolbar.cpp @@ -62,6 +62,7 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, BookmarkMenu::~BookmarkMenu() { + kDebug() << "Deleting BookmarkMenu.. See http://svn.reviewboard.kde.org/r/5606/ about."; } diff --git a/src/bookmarks/bookmarkstoolbar.h b/src/bookmarks/bookmarkstoolbar.h index b1e2a555..dee75310 100644 --- a/src/bookmarks/bookmarkstoolbar.h +++ b/src/bookmarks/bookmarkstoolbar.h @@ -28,6 +28,9 @@ #define BOOKMARKSTOOLBAR_H +// Rekonq Includes +#include "rekonq_defines.h" + // KDE Includes #include -- cgit v1.2.1