From 117685ef4efcd51da7dcff3d2565cfaaa30f7eee Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 8 Jul 2005 13:27:36 +0000 Subject: [PATCH] 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 --- kmmainwidget.cpp | 8 ++++---- kmmainwidget.h | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index 6123034a8..ac6a79176 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -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; diff --git a/kmmainwidget.h b/kmmainwidget.h index deb1b08ab..834c8bf5b 100644 --- a/kmmainwidget.h +++ b/kmmainwidget.h @@ -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,