Fix crash when closing the search dialog or KMail while search is in progress.

svn path=/trunk/kdenetwork/kmail/; revision=73081
wilder-work
Michael Haeckel 26 years ago
parent cce0ae902f
commit 1ea62b68f9
  1. 15
      kmfldsearch.cpp
  2. 5
      kmfldsearch.h
  3. 2
      kmmainwin.cpp

@ -41,6 +41,7 @@ KMFldSearch::KMFldSearch(KMMainWin* w, const char* name,
mNumRules = 2;
mSearching = false;
mCloseRequested = false;
setCaption(i18n("Search in Folders"));
mGrid = new QGridLayout(this, mNumRules+4, 5, 4, 4);
@ -338,6 +339,7 @@ void KMFldSearch::slotSearch()
enableGUI();
if( mLastFocus )
mLastFocus->setFocus();
if (mCloseRequested) close();
}
@ -354,6 +356,19 @@ void KMFldSearch::slotClose()
}
//-----------------------------------------------------------------------------
void KMFldSearch::closeEvent(QCloseEvent *e)
{
if (mSearching)
{
mSearching = false;
mCloseRequested = true;
e->ignore();
}
else e->accept();
}
//-----------------------------------------------------------------------------
void KMFldSearch::slotShowMsg(QListViewItem *item)
{

@ -58,6 +58,9 @@ protected:
/** Reimplemented to react to Escape. */
virtual void keyPressEvent(QKeyEvent*);
/** Reimplemented to stop searching when the window is closed */
virtual void closeEvent(QCloseEvent*);
protected:
QGridLayout* mGrid;
QComboBox *mCbxFolders;
@ -68,7 +71,7 @@ protected:
int mNumRules, mNumMatches;
int mCount;
QString mSearchFolder;
bool mSearching, mStopped;
bool mSearching, mStopped, mCloseRequested;
KMMainWin* mMainWin;
QWidget* mLastFocus;
};

@ -125,7 +125,7 @@ KMMainWin::KMMainWin(QWidget *, char *name) :
KMMainWin::~KMMainWin()
{
if (searchWin)
delete searchWin;
searchWin->close();
writeConfig();
writeFolderConfig();

Loading…
Cancel
Save