Found the reason why KMAcctCachedImap::processNewMail's assert below was hit

assert( mFolder );  // George says "better to crash then lose mail"
The configuration dialog creates temporary copies of the account when modifying one;
but it doesn't delete that copy when closing with Cancel. What's more, the copied account
started its own timer for interval-mail-checking, and when that timer fired, KMAcctCachedImap
would crash due to mFolder=0. So:
1) delete things in the dtor to avoid the account memleak
2) don't start the mailcheck timer when simply setting the checkinterval of an account,
   only when the account is added to the AccountManager for real.
(#117935)

svn path=/trunk/KDE/kdepim/; revision=631941
wilder-work
David Faure 19 years ago
parent 2ebce6f21b
commit bd9a11b36b
  1. 25
      configuredialog.cpp
  2. 1
      configuredialog_p.h
  3. 12
      kmaccount.cpp

@ -1174,6 +1174,28 @@ AccountsPageReceivingTab::AccountsPageReceivingTab( QWidget * parent )
this, SLOT(slotEditNotifications()) );
}
AccountsPageReceivingTab::~AccountsPageReceivingTab()
{
// When hitting Cancel or closing the dialog with the window-manager-button,
// we have a number of things to clean up:
// The newly created accounts
QList< QPointer<KMAccount> >::Iterator it;
for (it = mNewAccounts.begin(); it != mNewAccounts.end(); ++it ) {
delete (*it);
}
mNewAccounts.clear();
// The modified accounts
QList<ModifiedAccountsType*>::Iterator j;
for ( j = mModifiedAccounts.begin() ; j != mModifiedAccounts.end() ; ++j ) {
delete (*j)->newAccount;
delete (*j);
}
mModifiedAccounts.clear();
}
void AccountsPage::ReceivingTab::slotAccountSelected()
{
@ -1429,8 +1451,7 @@ void AccountsPage::ReceivingTab::save() {
// Add accounts marked as new
QList< QPointer<KMAccount> >::Iterator it;
for (it = mNewAccounts.begin(); it != mNewAccounts.end(); ++it ) {
kmkernel->acctMgr()->add( *it );
(*it)->installTimer();
kmkernel->acctMgr()->add( *it ); // calls installTimer too
}
// Update accounts that have been modified

@ -372,6 +372,7 @@ class AccountsPageReceivingTab : public ConfigModuleTab {
Q_OBJECT
public:
AccountsPageReceivingTab( QWidget * parent=0 );
~AccountsPageReceivingTab();
QString helpAnchor() const;
void save();

@ -154,6 +154,11 @@ void KMAccount::readConfig(KConfig& config)
{
setFolder(kmkernel->folderMgr()->findIdString(folderName), true);
}
if (mInterval == 0)
deinstallTimer();
else
installTimer();
}
@ -280,15 +285,10 @@ if( fileD0.open( QIODevice::WriteOnly ) ) {
void KMAccount::setCheckInterval(int aInterval)
{
if (aInterval <= 0)
{
mInterval = 0;
deinstallTimer();
}
else
{
mInterval = aInterval;
installTimer();
}
// Don't call installTimer from here! See #117935.
}
//----------------------------------------------------------------------------

Loading…
Cancel
Save