[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.3/kdeplasma-addons/applets/microblog
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2009-07-07 6:03:54
Message-ID: 1246946634.693733.28561.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 992500 by aseigo:

don't continue to add to the tweet map. not technically a memory _leak_, but \
certainly a memory growth. *sigh* this widget has had a very spotty time with memory \
management. CCBUG:199226


 M  +8 -4      microblog.cpp  
 M  +3 -3      microblog.h  


--- branches/KDE/4.3/kdeplasma-addons/applets/microblog/microblog.cpp #992499:992500
@@ -445,7 +445,6 @@
         Plasma::Frame *tweetFrame = new Plasma::Frame(m_tweetsWidget);
         tweetFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 
-
         QGraphicsLinearLayout *tweetLayout = new QGraphicsLinearLayout( \
Qt::Horizontal, tweetFrame );  tweetLayout->setContentsMargins( 0, 5, 0, 5 );
         tweetLayout->setSpacing( 5 );
@@ -472,7 +471,6 @@
         tweetLayout->addItem(tweetText);
         tweetLayout->addItem(favIcon);
 
-
         Tweet t;
         t.frame = tweetFrame;
         t.icon = icon;
@@ -494,8 +492,14 @@
     }
 
     int i = 0;
-    QMap<uint, Plasma::DataEngine::Data>::const_iterator it = m_tweetMap.constEnd();
-    while (i < m_historySize && it != m_tweetMap.constBegin()) {
+    QMap<uint, Plasma::DataEngine::Data>::iterator it = m_tweetMap.end();
+    while (it != m_tweetMap.begin()) {
+        if (i >= m_historySize) {
+            it = m_tweetMap.erase(it);
+            --it;
+            continue;
+        }
+
         Plasma::DataEngine::Data tweetData = *(--it);
         QString user = tweetData.value( "User" ).toString();
         QPixmap favIcon = tweetData.value("SourceFavIcon").value<QPixmap>();
--- branches/KDE/4.3/kdeplasma-addons/applets/microblog/microblog.h #992499:992500
@@ -157,9 +157,9 @@
         Plasma::Service *m_profileService;
         QString m_curTimeline;
 
-        QMap< QString, QPixmap > m_pictureMap;
-        QMap< uint, Plasma::DataEngine::Data > m_tweetMap;
-        QList< Tweet > m_tweetWidgets;
+        QMap<QString, QPixmap> m_pictureMap;
+        QMap<uint, Plasma::DataEngine::Data> m_tweetMap;
+        QList<Tweet> m_tweetWidgets;
 
         uint m_lastTweet;
         KWallet::Wallet *m_wallet;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic