Summary: | crash when quitting while fetching | ||
---|---|---|---|
Product: | [Applications] akregator | Reporter: | Frank Osterfeld <osterfeld> |
Component: | general | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | tpr |
Priority: | NOR | ||
Version: | cvs | ||
Target Milestone: | --- | ||
Platform: | Unlisted Binaries | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Frank Osterfeld
2004-12-25 15:15:15 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(); |