Control: tag -1 + patch On Sat, 16 Nov 2013 21:18:50 +0100, gregor herrmann wrote:
> > But I'll try with the packaged version as soon as I can get hold of > > it :) > > It might be better but still ... > > Currently, dianara (the packaged version) is running since 2 or 3 > days, and the memory usage (copied from htop) looks like: > > PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command > 23560 gregoa 20 0 1738M 1055M 13332 S 0.0 27.4 0:16.46 dianara > 20806 gregoa 20 0 1268M 382M 58028 S 0.0 10.0 48:56.15 iceweasel ¡Hola Mònica, hola Jan! This looks better, doesn't it :) PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 31723 gregoa 20 0 556M 60748 19616 S 0.0 1.5 12:30.11 ./dianara 5789 gregoa 20 0 1752M 628M 44124 S 4.8 16.4 2h13:06 iceweasel With the help of a friend and qtcreator's nice valgrind integration I created a patch which adds parents to some objects (so that they are auto-reaped) or manually deletes them. No guarantees that all parts of the patch are necessary or correct but with it dianara is "valgrind clean" and the memory usage stays constant even after running for several days. The patch applies against git HEAD as of now (d520e57); I hope it serves as a starting point to get the memory leaks fixed. Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - http://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `-
diff --git a/src/comment.cpp b/src/comment.cpp index 5c1ec39..c6abc84 100644 --- a/src/comment.cpp +++ b/src/comment.cpp @@ -247,6 +247,11 @@ Comment::Comment(PumpController *pumpController, Comment::~Comment() { + delete likeLabel; + delete quoteLabel; + delete editLabel; + delete deleteLabel; + delete contentLabel; qDebug() << "Comment destroyed" << this->commentId; } diff --git a/src/composer.cpp b/src/composer.cpp index ad560cc..5247ea3 100644 --- a/src/composer.cpp +++ b/src/composer.cpp @@ -31,12 +31,12 @@ Composer::Composer(bool forPublisher) QFont startConversationFont; startConversationFont.setPointSize(startConversationFont.pointSize() - 2); - startConversationLabel = new QLabel(tr("Click here or press Control+N to post a note...")); + startConversationLabel = new QLabel(tr("Click here or press Control+N to post a note..."), this); startConversationLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); startConversationLabel->setFont(startConversationFont); // A menu to insert some Unicode symbols - symbolsMenu = new QMenu(tr("Symbols")); + symbolsMenu = new QMenu(tr("Symbols"), this); symbolsMenu->setIcon(QIcon::fromTheme("character-set")); symbolsMenu->addAction(QString::fromUtf8("\342\230\272")); // Smiling face symbolsMenu->addAction(QString::fromUtf8("\342\230\271")); // Sad face @@ -54,7 +54,7 @@ Composer::Composer(bool forPublisher) this, SLOT(insertSymbol(QAction*))); - toolsMenu = new QMenu(tr("Formatting")); + toolsMenu = new QMenu(tr("Formatting"), this); toolsMenu->addAction(QIcon::fromTheme(""), tr("Normal"), this, diff --git a/src/contactcard.cpp b/src/contactcard.cpp index 5910c3b..8008074 100644 --- a/src/contactcard.cpp +++ b/src/contactcard.cpp @@ -149,14 +149,14 @@ ContactCard::ContactCard(PumpController *pumpController, connect(sendMessageAction, SIGNAL(triggered()), this, SLOT(setMessagingModeForContact())); - addToListMenu = new QMenu(tr("In Lists...")); + addToListMenu = new QMenu(tr("In Lists..."), this); addToListMenu->setIcon(QIcon::fromTheme("format-list-unordered")); addToListMenu->addAction("fake list 1")->setCheckable(true); // FIXME... addToListMenu->addAction("fake list 2")->setCheckable(true); addToListMenu->addAction("fake list 3")->setCheckable(true); - optionsMenu = new QMenu("*options*"); + optionsMenu = new QMenu("*options*", this); optionsMenu->addAction(openProfileAction); optionsMenu->addAction(sendMessageAction); //optionsMenu->addMenu(addToListMenu); // Don't include it for now, until 1.3 /FIXME diff --git a/src/contactlist.cpp b/src/contactlist.cpp index ceaf0bf..d455f19 100644 --- a/src/contactlist.cpp +++ b/src/contactlist.cpp @@ -102,7 +102,7 @@ ContactList::ContactList(PumpController *pumpController, ASPerson *demoContactPerson = new ASPerson(demoContactData); ContactCard *demoContactCard = new ContactCard(this->pController, this->globalObj, - demoContactPerson); + demoContactPerson, this); this->contactsLayout->addWidget(demoContactCard); this->contactsInList.append(demoContactCard); @@ -143,7 +143,7 @@ void ContactList::setListContents(QString listType, ASPerson *person = new ASPerson(contact.toMap()); ContactCard *contactCard = new ContactCard(this->pController, this->globalObj, - person); + person, this); contactInfoLineString = person->getName() + " <" diff --git a/src/contactmanager.cpp b/src/contactmanager.cpp index 7f6c115..955509c 100644 --- a/src/contactmanager.cpp +++ b/src/contactmanager.cpp @@ -77,7 +77,7 @@ ContactManager::ContactManager(PumpController *pumpController, // Widgets for list of 'following' and 'followers' this->followingWidget = new ContactList(this->pController, globalObject, - "following"); + "following", this); connect(pController, SIGNAL(contactFollowed(ASPerson*)), followingWidget, SLOT(addSingleContact(ASPerson*))); connect(pController, SIGNAL(contactUnfollowed(ASPerson*)), @@ -89,7 +89,7 @@ ContactManager::ContactManager(PumpController *pumpController, this->followersWidget = new ContactList(this->pController, globalObject, - "followers"); + "followers", this); // Widget for the list of 'person lists' @@ -101,7 +101,7 @@ ContactManager::ContactManager(PumpController *pumpController, // Options menu - optionsMenu = new QMenu("*options-menu*"); + optionsMenu = new QMenu("*options-menu*", this); optionsMenu->addAction(QIcon::fromTheme("view-refresh", QIcon(":/images/menu-refresh.png")), tr("Reload Followers"), diff --git a/src/imageviewer.cpp b/src/imageviewer.cpp index a05b24a..6ff7454 100644 --- a/src/imageviewer.cpp +++ b/src/imageviewer.cpp @@ -155,7 +155,7 @@ void ImageViewer::createContextMenu() this, SLOT(close())); - this->contextMenu = new QMenu("imageViewerMenu"); + this->contextMenu = new QMenu("imageViewerMenu", this); contextMenu->addAction(saveAction); contextMenu->addAction(closeAction); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f6c0f5d..a5e52f5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -127,7 +127,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) meanwhileFeed = new MinorFeed(PumpController::MinorFeedMainRequest, pumpController, globalObject, - filterChecker); + filterChecker, this); connect(meanwhileFeed, SIGNAL(newItemsCountChanged(int,int)), this, SLOT(setMinorFeedTitle(int,int))); connect(meanwhileFeed, SIGNAL(newItemsReceived(int,int)), @@ -147,7 +147,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) mentionsFeed = new MinorFeed(PumpController::MinorFeedDirectRequest, pumpController, globalObject, - filterChecker); + filterChecker, this); connect(mentionsFeed, SIGNAL(newItemsCountChanged(int,int)), this, SLOT(setMentionsFeedTitle(int,int))); //connect(mentionsFeed, SIGNAL(newItemsReceived(int,int)), @@ -165,7 +165,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) actionsFeed = new MinorFeed(PumpController::MinorFeedActivityRequest, pumpController, globalObject, - filterChecker); + filterChecker, this); leftPanel->addItem(actionsFeed, QIcon::fromTheme("mail-folder-outbox", QIcon(":/images/feed-outbox.png")), @@ -406,7 +406,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) // FreeDesktop.org notifications handler - fdNotifier = new FDNotifications(); + fdNotifier = new FDNotifications(this); connect(fdNotifier, SIGNAL(showFallbackNotification(QString,QString)), this, SLOT(showTrayFallbackMessage(QString,QString))); @@ -728,7 +728,7 @@ void MainWindow::prepareDataDirectory() */ void MainWindow::createMenus() { - sessionMenu = new QMenu(tr("&Session")); + sessionMenu = new QMenu(tr("&Session"), this); sessionUpdateMainTimeline = new QAction(QIcon::fromTheme("view-refresh", QIcon(":/images/menu-refresh.png")), @@ -853,7 +853,7 @@ void MainWindow::createMenus() this->menuBar()->addMenu(sessionMenu); - viewMenu = new QMenu(tr("&View")); + viewMenu = new QMenu(tr("&View"), this); viewSidePanel = new QAction(QIcon::fromTheme("view-sidetree"), tr("Side &Panel"), this); @@ -911,7 +911,7 @@ void MainWindow::createMenus() - settingsMenu = new QMenu(tr("S&ettings")); + settingsMenu = new QMenu(tr("S&ettings"), this); settingsEditProfile = new QAction(QIcon::fromTheme("user-properties", QIcon(":/images/no-avatar.png")), @@ -950,7 +950,7 @@ void MainWindow::createMenus() - helpMenu = new QMenu(tr("&Help")); + helpMenu = new QMenu(tr("&Help"), this); helpBasicHelp = new QAction(QIcon::fromTheme("help-browser"), tr("Basic &Help"), this); @@ -1023,7 +1023,7 @@ void MainWindow::createMenus() connect(trayShowWindowAction, SIGNAL(triggered()), this, SLOT(toggleMainWindow())); - trayContextMenu = new QMenu("Tray Context Menu"); + trayContextMenu = new QMenu("Tray Context Menu", this); trayContextMenu->setSeparatorsCollapsible(false); trayContextMenu->addAction(trayTitleSeparatorAction); // Acts as title trayContextMenu->addAction(trayShowWindowAction); diff --git a/src/minorfeed.cpp b/src/minorfeed.cpp index 68a5333..34daf67 100644 --- a/src/minorfeed.cpp +++ b/src/minorfeed.cpp @@ -41,7 +41,7 @@ MinorFeed::MinorFeed(PumpController::requestTypes minorFeedType, itemsLayout->setAlignment(Qt::AlignTop); // Separator frame, to mark where new items end - separatorFrame = new QFrame(); + separatorFrame = new QFrame(this); separatorFrame->setFrameStyle(QFrame::HLine); separatorFrame->setMinimumHeight(28); separatorFrame->setContentsMargins(0, 8, 0, 8); diff --git a/src/notifications.cpp b/src/notifications.cpp index 7d4733e..85fc96a 100644 --- a/src/notifications.cpp +++ b/src/notifications.cpp @@ -21,7 +21,7 @@ #include "notifications.h" -FDNotifications::FDNotifications() +FDNotifications::FDNotifications(QObject* parent) : QObject(parent) { qDebug() << "Creating FreeDesktop Notifier"; this->notificationsAvailable = false; // Init as false, detect later @@ -58,6 +58,7 @@ FDNotifications::FDNotifications() FDNotifications::~FDNotifications() { + delete bus; qDebug() << "FreeDesktop Notifier destroyed"; } diff --git a/src/notifications.h b/src/notifications.h index c7e5507..2c7c15d 100644 --- a/src/notifications.h +++ b/src/notifications.h @@ -38,7 +38,7 @@ class FDNotifications : public QObject Q_OBJECT public: - FDNotifications(); + FDNotifications(QObject* parent); ~FDNotifications(); bool areNotificationsAvailable(); diff --git a/src/publisher.cpp b/src/publisher.cpp index 0fdcc78..ca05a39 100644 --- a/src/publisher.cpp +++ b/src/publisher.cpp @@ -47,6 +47,8 @@ Publisher::Publisher(PumpController *pumpController, this->editingMode = false; // False unless set from setEditingMode // after clicking "Edit" in a post + this->defaultPublicPosting = false; // initialize + this->setFocusPolicy(Qt::StrongFocus); // To keep the publisher from getting focus by accident @@ -137,12 +139,12 @@ Publisher::Publisher(PumpController *pumpController, connect(toFollowersAction, SIGNAL(toggled(bool)), this, SLOT(setToFollowers(bool))); - toSelectorListsMenu = new QMenu(tr("Lists")); + toSelectorListsMenu = new QMenu(tr("Lists"), this); toSelectorListsMenu->setDisabled(true); // Disabled until lists are received, if any connect(toSelectorListsMenu, SIGNAL(triggered(QAction*)), this, SLOT(updateToListsFields(QAction*))); - toSelectorMenu = new QMenu("to-menu"); + toSelectorMenu = new QMenu("to-menu", this); toSelectorMenu->addAction(toPublicAction); toSelectorMenu->addAction(toFollowersAction); toSelectorMenu->addMenu(toSelectorListsMenu); @@ -170,12 +172,12 @@ Publisher::Publisher(PumpController *pumpController, connect(ccFollowersAction, SIGNAL(toggled(bool)), this, SLOT(setCCFollowers(bool))); - ccSelectorListsMenu = new QMenu(tr("Lists")); + ccSelectorListsMenu = new QMenu(tr("Lists"), this); ccSelectorListsMenu->setDisabled(true); // Disabled until lists are received, if any connect(ccSelectorListsMenu, SIGNAL(triggered(QAction*)), this, SLOT(updateCcListsFields(QAction*))); - ccSelectorMenu = new QMenu("cc-menu"); + ccSelectorMenu = new QMenu("cc-menu", this); ccSelectorMenu->addAction(ccPublicAction); ccSelectorMenu->addAction(ccFollowersAction); ccSelectorMenu->addMenu(ccSelectorListsMenu); @@ -251,7 +253,7 @@ Publisher::Publisher(PumpController *pumpController, // The menu itself - addMediaMenu = new QMenu(); + addMediaMenu = new QMenu(this); addMediaMenu->addAction(addMediaImageAction); addMediaMenu->addAction(addMediaAudioAction); addMediaMenu->addAction(addMediaVideoAction); diff --git a/src/pumpcontroller.cpp b/src/pumpcontroller.cpp index 229a87e..49467aa 100644 --- a/src/pumpcontroller.cpp +++ b/src/pumpcontroller.cpp @@ -30,7 +30,7 @@ PumpController::PumpController(QObject *parent) : QObject(parent) this->proxyUsesAuth = false; - qoauth = new QOAuth::Interface(); + qoauth = new QOAuth::Interface(this); qoauth->setRequestTimeout(10000); // 10 sec timeout QSettings settings;
signature.asc
Description: Digital Signature