Bug 95816 - crash when quitting while fetching
Summary: crash when quitting while fetching
Status: RESOLVED FIXED
Alias: None
Product: akregator
Classification: Applications
Component: general (show other bugs)
Version: cvs
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-25 15:15 UTC by Frank Osterfeld
Modified: 2005-01-02 10:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Osterfeld 2004-12-25 15:15:15 UTC
Akregator crashes on exit, when it's fetching while quitting, caused by the 
progress item. 
Teemu: The progress item seems to be deleted on exit, _before_ it's accessed in 
our destructing code. 
 
Using host libthread_db library "/lib/libthread_db.so.1". 
[KCrash handler] 
#5  0xb6d381c2 in QString::deref() () from /usr/qt/3/lib/libqt-mt.so.3 
#6  0xb6d3849c in QString::operator=(QString const&) () 
   from /usr/qt/3/lib/libqt-mt.so.3 
#7  0xb7a6807d in KPIM::ProgressItem::setStatus(QString const&) (this=0xd0,  
    v=@0xbfffed00) at progressmanager.cpp:116 
#8  0xb61c8c17 in Akregator::Feed::abortFetch() (this=0x8390868) 
    at feed.cpp:361 
#9  0xb61cb483 in Akregator::FetchTransaction::stop() (this=0x81d7870) 
    at fetchtransaction.cpp:59 
#10 0xb61cb303 in ~FetchTransaction (this=0x81d7870) at fetchtransaction.cpp:28 
#11 0xb6a8393c in QWidget::~QWidget() () from /usr/qt/3/lib/libqt-mt.so.3 
#12 0xb61f56f8 in ~View (this=0x8254580) at akregator_view.cpp:89 
#13 0xb795f24b in ~Part (this=0x825c398, __vtt_parm=0xb621b5cc) at part.cpp:159 
#14 0xb795fdff in ~ReadOnlyPart (this=0x825c398, __vtt_parm=0xb621b5c8) 
    at part.cpp:312 
#15 0xb7a217ed in ~Part (this=0x825c398, __vtt_parm=0xb621b5c4) at part.cpp:32 
#16 0xb61f12f9 in ~Part (this=0x825c398) at akregator_part.cpp:199 
#17 0x0805353b in AkregatorMainWindow::queryExit() (this=0x819b238) 
    at akregator.cpp:301 
#18 0xb72d6423 in KMainWindow::shuttingDown() (this=0x819b238) 
    at kmainwindow.cpp:1090 
#19 0xb72d7065 in KMainWindow::qt_invoke(int, QUObject*) (this=0x819b238,  
    _id=71, _o=0xbfffefb0) at kmainwindow.moc:139 
#20 0xb796cc5b in KParts::MainWindow::qt_invoke(int, QUObject*) ( 
    this=0x819b238, _id=71, _o=0xbfffefb0) at mainwindow.moc:98 
#21 0x08053dd7 in AkregatorMainWindow::qt_invoke(int, QUObject*) ( 
    this=0x819b238, _id=71, _o=0xbfffefb0) at akregator.moc:199 
#22 0xb6a4b194 in QObject::activate_signal(QConnectionList*, QUObject*) () 
   from /usr/qt/3/lib/libqt-mt.so.3 
#23 0xb6a4b92c in QObject::activate_signal(int) () 
   from /usr/qt/3/lib/libqt-mt.so.3 
#24 0xb6fdbb9b in KApplication::shutDown() (this=0xbffff250) 
    at kapplication.moc:232 
#25 0xb6fdbf14 in KApplication::qt_emit(int, QUObject*) (this=0xbffff250,  
    _id=15, _o=0xbffff110) at kapplication.moc:270 
#26 0xb707d3b1 in KUniqueApplication::qt_emit(int, QUObject*) ( 
    this=0xbffff250, _id=15, _o=0xbffff110) at kuniqueapplication.moc:96 
#27 0x08052019 in aKregatorApp::qt_emit(int, QUObject*) (this=0xbffff250,  
    _id=15, _o=0xbffff110) at app.moc:82 
#28 0xb6a4b20c in QObject::activate_signal(QConnectionList*, QUObject*) () 
   from /usr/qt/3/lib/libqt-mt.so.3 
#29 0xb6a4b92c in QObject::activate_signal(int) () 
   from /usr/qt/3/lib/libqt-mt.so.3 
#30 0xb6d9e11a in QApplication::aboutToQuit() () 
   from /usr/qt/3/lib/libqt-mt.so.3 
#31 0xb69fdc81 in QEventLoop::enterLoop() () from /usr/qt/3/lib/libqt-mt.so.3 
#32 0xb69fdb56 in QEventLoop::exec() () from /usr/qt/3/lib/libqt-mt.so.3 
#33 0xb69e62af in QApplication::exec() () from /usr/qt/3/lib/libqt-mt.so.3 
#34 0x0805144b in main (argc=7, argv=0xbffff3e4) at main.cpp:67
Comment 1 Frank Osterfeld 2005-01-02 10:56:27 UTC
CVS commit by osterfeld: 

Improved shutdown code. Doesn't crash anymore when quitting while a fetch is active.
BUG: 95816


  M +29 -9     akregator_view.cpp   1.203
  M +5 -0      akregator_view.h   1.83


--- kdepim/akregator/src/akregator_view.cpp  #1.202:1.203
@@ -78,14 +78,14 @@ using namespace Akregator;
 View::~View()
 {
-    m_shuttingDown = true; // prevents slotFrameChanged from crashing
-    // close all pageviewers in a controlled way
-    // fixes bug 91660, at least when no part loading data
-    m_tabs->setCurrentPage(m_tabs->count()-1); // select last page
-    while (m_tabs->count() > 1) // remove frames until only the main frame remains
-        slotRemoveFrame();
+    // if m_shuttingDown is false, slotOnShutDown was not called. That
+     // means that not the whole app is shutdown, only the part. So it
+    // should be no risk to do the cleanups now
+    if (!m_shuttingDown)
+    {
+        kdDebug() << "View::~View(): slotOnShutDown() wasn't called. Calling it now." << endl;
+        slotOnShutDown();
+    }
+    kdDebug() << "View::~View(): leaving" << endl;
     
-    delete m_mainTab;
-    delete m_mainFrame;
-    delete m_feedList;
 }
 
@@ -93,4 +93,6 @@ View::View( Part *part, QWidget *parent,
  : QWidget(parent, name), m_viewMode(NormalView)
 {
+    connect(kapp, SIGNAL(shutDown()), this, SLOT(slotOnShutDown()));
+    
     m_keepFlagIcon = QPixmap(locate("data", "akregator/pics/akregator_flag.png"));
     m_part = part;
@@ -264,4 +266,22 @@ void View::delayedInit()
 }
 
+void View::slotOnShutDown()
+{
+    kdDebug() << "entering View::slotOnShutDown()" << endl;
+    m_shuttingDown = true; // prevents slotFrameChanged from crashing
+
+    m_transaction->stop();
+    delete m_feedList;
+    
+    // close all pageviewers in a controlled way
+    // fixes bug 91660, at least when no part loading data
+    m_tabs->setCurrentPage(m_tabs->count()-1); // select last page
+    while (m_tabs->count() > 1) // remove frames until only the main frame remains
+        slotRemoveFrame();
+    
+    delete m_mainTab;
+    delete m_mainFrame;
+}
+
 void View::saveSettings()
 {

--- kdepim/akregator/src/akregator_view.h  #1.82:1.83
@@ -60,4 +60,7 @@ namespace Akregator
             */
             View(Akregator::Part *part, QWidget *parent, const char* name);
+
+            /** destructor.  Note that cleanups should be done in
+            slotOnShutDown(), so we don't risk accessing self-deleting objects after deletion. */
             ~View();
 
@@ -265,4 +268,6 @@ namespace Akregator
             void delayedInit();
             
+            void slotOnShutDown();
+            
             void slotActivateSearch();