Fix uninit read on startup due to my "troubleshoot imap cache" folder-related action,

thanks to Michel Hermier on IRC for the valgrind logs.

svn path=/trunk/KDE/kdepim/; revision=432771
wilder-work
David Faure 21 years ago
parent 9713d42c1d
commit 117685ef4e
  1. 8
      kmmainwidget.cpp
  2. 6
      kmmainwidget.h

@ -2838,7 +2838,7 @@ void KMMainWidget::setupActions()
connect( kmkernel->undoStack(),
SIGNAL( undoStackChanged() ), this, SLOT( slotUpdateUndo() ));
initializeIMAPActions();
initializeIMAPActions( false ); // don't set state, config not read yet
updateMessageActions();
}
@ -3396,7 +3396,7 @@ void KMMainWidget::slotFolderRemoved( KMFolder *folder )
}
//-----------------------------------------------------------------------------
void KMMainWidget::initializeIMAPActions()
void KMMainWidget::initializeIMAPActions( bool setState /* false the first time, true later on */ )
{
bool hasImapAccount = false;
for( KMAccount *a = kmkernel->acctMgr()->first(); a;
@ -3410,14 +3410,14 @@ void KMMainWidget::initializeIMAPActions()
return; // nothing to do
KXMLGUIFactory* factory = mGUIClient->factory();
kdDebug() << k_funcinfo << endl;
if ( factory )
factory->removeClient( mGUIClient );
if ( !mTroubleshootFolderAction ) {
mTroubleshootFolderAction = new KAction( i18n("&Troubleshoot IMAP Cache..."), "wizard", 0,
this, SLOT(slotTroubleshootFolder()), actionCollection(), "troubleshoot_folder" );
updateFolderMenu(); // set initial state of the action
if ( setState )
updateFolderMenu(); // set initial state of the action
} else {
delete mTroubleshootFolderAction ;
mTroubleshootFolderAction = 0;

@ -213,7 +213,7 @@ public slots:
void initializeFilterActions();
/** Create IMAP-account-related actions if applicable */
void initializeIMAPActions();
void initializeIMAPActions() { initializeIMAPActions( true ); }
/** Create actions for the folder shortcuts. */
void initializeFolderShortcutActions();
@ -361,7 +361,7 @@ protected slots:
/** Copy selected messages to folder with corresponding to given menuid */
virtual void copySelectedToFolder( int menuId );
/** Update html and threaded messages preferences in Folder menu. */
virtual void updateFolderMenu();
void updateFolderMenu();
/** Enable or disable the "mark all as read" action. Needs to happen more
* often the the other updates and is therefor in its own method. */
void updateMarkAsReadAction();
@ -403,6 +403,8 @@ private:
/** Get override character encoding. */
QString overrideEncoding() const;
void initializeIMAPActions( bool setState );
private:
// Message actions
KAction *mTrashAction, *mDeleteAction, *mTrashThreadAction,

Loading…
Cancel
Save