rev 5893 - in trunk/packages/kdepim/debian: . patches

Sune Vuorela pusling-guest at alioth.debian.org
Fri Apr 13 12:32:17 UTC 2007


Author: pusling-guest
Date: 2007-04-13 12:32:16 +0000 (Fri, 13 Apr 2007)
New Revision: 5893

Added:
   trunk/packages/kdepim/debian/patches/01_branch_627763.diff
   trunk/packages/kdepim/debian/patches/01_branch_630633_store_kwallet_passwords.diff
   trunk/packages/kdepim/debian/patches/01_branch_630850_fix_crm114_typo.diff
   trunk/packages/kdepim/debian/patches/01_branch_631934_fix_kmail_dimap_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_633069_c++_fixes.diff
   trunk/packages/kdepim/debian/patches/01_branch_633071_kmail_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_643329_imap_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_643369_template_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_644873_fix_open_count.diff
   trunk/packages/kdepim/debian/patches/01_branch_644877_dont_crash_if_folders_are_deleted.diff
   trunk/packages/kdepim/debian/patches/01_branch_644897_fix_imap_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_644903_fix_folder_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_644988_fix_imap_account_creation_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_645047_kmail_crash_gpg_related.diff
   trunk/packages/kdepim/debian/patches/01_branch_645389_kmail_crash_delete_imap.diff
   trunk/packages/kdepim/debian/patches/01_branch_645673_ensure_main_widget.diff
   trunk/packages/kdepim/debian/patches/01_branch_645830_dont_crash_if_folder_gone.diff
   trunk/packages/kdepim/debian/patches/01_branch_649334_fix_kmail_folder_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_649957_guard_possible_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_650978_guard_more_crash.diff
   trunk/packages/kdepim/debian/patches/01_branch_650987_fix_crash_creating_index.diff
Modified:
   trunk/packages/kdepim/debian/changelog
Log:
fix kmail crashes


Modified: trunk/packages/kdepim/debian/changelog
===================================================================
--- trunk/packages/kdepim/debian/changelog	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/changelog	2007-04-13 12:32:16 UTC (rev 5893)
@@ -5,9 +5,12 @@
   +++ Changes by Sune Vuorela
   * Pull 2 patches from pim+ branch to fix compilation with pilot-link 0.12.2
     (Closes: #414843)
+  * Pull a lot of kmail patches from upstream to fix various crashes 
+    (Closes: #413527, #398182, #412261, #407363, #280223, ) and probably a
+    couple of more
   * Add clamav patch - thanks to Stephen Gran (Closes: 412861)
 
- -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Wed, 14 Mar 2007 10:49:37 +0100
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Fri, 13 Apr 2007 13:50:38 +0200
 
 kdepim (4:3.5.6.dfsg.1-2) experimental; urgency=low
 

Added: trunk/packages/kdepim/debian/patches/01_branch_627763.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_627763.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_627763.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,23 @@
+Index: kdepim/kmail/kmreaderwin.cpp
+===================================================================
+--- kdepim/kmail/kmreaderwin.cpp	(revision 627762)
++++ kdepim/kmail/kmreaderwin.cpp	(revision 627763)
+@@ -636,13 +636,13 @@
+   mSelectEncodingAction->setItems( encodings );
+   mSelectEncodingAction->setCurrentItem( 0 );
+ 
+-  mMailToComposeAction = new KAction( i18n("New Message To..."), 0, this,
+-                                      SLOT(slotMailtoCompose()), ac,
++  mMailToComposeAction = new KAction( i18n("New Message To..."), "mail_new",
++                                      0, this, SLOT(slotMailtoCompose()), ac,
+                                       "mailto_compose" );
+-  mMailToReplyAction = new KAction( i18n("Reply To..."), 0, this,
+-				    SLOT(slotMailtoReply()), ac,
++  mMailToReplyAction = new KAction( i18n("Reply To..."), "mail_reply",
++                                    0, this, SLOT(slotMailtoReply()), ac,
+ 				    "mailto_reply" );
+-  mMailToForwardAction = new KAction( i18n("Forward To..."),
++  mMailToForwardAction = new KAction( i18n("Forward To..."), "mail_forward",
+                                       0, this, SLOT(slotMailtoForward()), ac,
+                                       "mailto_forward" );
+   mAddAddrBookAction = new KAction( i18n("Add to Address Book"),

Added: trunk/packages/kdepim/debian/patches/01_branch_630633_store_kwallet_passwords.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_630633_store_kwallet_passwords.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_630633_store_kwallet_passwords.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,22 @@
+Index: kdepim/kmail/kmtransport.cpp
+===================================================================
+--- kdepim/kmail/kmtransport.cpp	(revision 630632)
++++ kdepim/kmail/kmtransport.cpp	(revision 630633)
+@@ -126,15 +126,15 @@
+   if ( storePasswd() ) {
+     // write password into the wallet if possible and necessary
+     bool passwdStored = false;
++    Wallet *wallet = kmkernel->wallet();
+     if ( mPasswdDirty ) {
+-      Wallet *wallet = kmkernel->wallet();
+       if ( wallet && wallet->writePassword( "transport-" + QString::number(mId), passwd() ) == 0 ) {
+         passwdStored = true;
+         mPasswdDirty = false;
+         mStorePasswdInConfig = false;
+       }
+     } else {
+-      passwdStored = !mStorePasswdInConfig; // already in the wallet
++      passwdStored = wallet ? !mStorePasswdInConfig /*already in the wallet*/ : config->hasKey("pass");
+     }
+     // wallet not available, ask the user if we should use the config file instead
+     if ( !passwdStored && ( mStorePasswdInConfig ||  KMessageBox::warningYesNo( 0,

Added: trunk/packages/kdepim/debian/patches/01_branch_630850_fix_crm114_typo.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_630850_fix_crm114_typo.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_630850_fix_crm114_typo.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,13 @@
+Index: kdepim/kmail/kmail.antispamrc
+===================================================================
+--- kdepim/kmail/kmail.antispamrc	(revision 630849)
++++ kdepim/kmail/kmail.antispamrc	(revision 630850)
+@@ -216,7 +216,7 @@
+ Version=1
+ Priority=65
+ VisibleName=CRM114
+-Executeable=crm -v | grep "CRM114"
++Executable=crm -v | grep "CRM114"
+ URL=http://crm114.sourceforge.net
+ PipeFilterName=CRM114 Check
+ PipeCmdDetect=crm -u $HOME/.crm114 mailreaver.crm

Added: trunk/packages/kdepim/debian/patches/01_branch_631934_fix_kmail_dimap_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_631934_fix_kmail_dimap_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_631934_fix_kmail_dimap_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,98 @@
+Index: kdepim/kmail/configuredialog_p.h
+===================================================================
+--- kdepim/kmail/configuredialog_p.h	(revision 631933)
++++ kdepim/kmail/configuredialog_p.h	(revision 631934)
+@@ -349,6 +349,7 @@
+   Q_OBJECT
+ public:
+   AccountsPageReceivingTab( QWidget * parent=0, const char * name=0 );
++  ~AccountsPageReceivingTab();
+   QString helpAnchor() const;
+   void save();
+ 
+@@ -384,7 +385,7 @@
+     QGuardedPtr< KMAccount > oldAccount;
+     QGuardedPtr< KMAccount > newAccount;
+   };
+-  // ### make this a qptrlist:
++  // ### make this value-based:
+   QValueList< ModifiedAccountsType* >  mModifiedAccounts;
+ };
+ 
+Index: kdepim/kmail/kmaccount.cpp
+===================================================================
+--- kdepim/kmail/kmaccount.cpp	(revision 631933)
++++ kdepim/kmail/kmaccount.cpp	(revision 631934)
+@@ -151,6 +151,11 @@
+   {
+     setFolder(kmkernel->folderMgr()->findIdString(folderName), true);
+   }
++
++  if (mInterval == 0)
++    deinstallTimer();
++  else
++    installTimer();
+ }
+ 
+ 
+@@ -278,15 +283,10 @@
+ void KMAccount::setCheckInterval(int aInterval)
+ {
+   if (aInterval <= 0)
+-  {
+     mInterval = 0;
+-    deinstallTimer();
+-  }
+   else
+-  {
+     mInterval = aInterval;
+-    installTimer();
+-  }
++  // Don't call installTimer from here! See #117935.
+ }
+ 
+ //----------------------------------------------------------------------------
+Index: kdepim/kmail/configuredialog.cpp
+===================================================================
+--- kdepim/kmail/configuredialog.cpp	(revision 631933)
++++ kdepim/kmail/configuredialog.cpp	(revision 631934)
+@@ -1147,7 +1147,29 @@
+            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
++  QValueList< QGuardedPtr<KMAccount> >::Iterator it;
++  for (it = mNewAccounts.begin(); it != mNewAccounts.end(); ++it ) {
++    delete (*it);
++  }
++  mNewAccounts.clear();
++
++  // The modified accounts
++  QValueList<ModifiedAccountsType*>::Iterator j;
++  for ( j = mModifiedAccounts.begin() ; j != mModifiedAccounts.end() ; ++j ) {
++    delete (*j)->newAccount;
++    delete (*j);
++  }
++  mModifiedAccounts.clear();
++
++
++}
++
+ void AccountsPage::ReceivingTab::slotAccountSelected()
+ {
+   QListViewItem * item = mAccountList->selectedItem();
+@@ -1398,8 +1420,7 @@
+   // Add accounts marked as new
+   QValueList< QGuardedPtr<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

Added: trunk/packages/kdepim/debian/patches/01_branch_633069_c++_fixes.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_633069_c++_fixes.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_633069_c++_fixes.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,157 @@
+Index: kdepim/kmail/kmmsgbase.cpp
+===================================================================
+--- kdepim/kmail/kmmsgbase.cpp	(revision 633068)
++++ kdepim/kmail/kmmsgbase.cpp	(revision 633069)
+@@ -118,7 +118,7 @@
+ //-----------------------------------------------------------------------------
+ bool KMMsgBase::isMessage(void) const
+ {
+-  return FALSE;
++  return false;
+ }
+ //-----------------------------------------------------------------------------
+ void KMMsgBase::toggleStatus(const KMMsgStatus aStatus, int idx)
+@@ -152,7 +152,7 @@
+ //-----------------------------------------------------------------------------
+ void KMMsgBase::setStatus(const KMMsgStatus aStatus, int idx)
+ {
+-  mDirty = TRUE;
++  mDirty = true;
+   KMMsgStatus oldStatus = status();
+   switch (aStatus) {
+     case KMMsgStatusRead:
+@@ -300,7 +300,7 @@
+ void KMMsgBase::setEncryptionState( const KMMsgEncryptionState /*status*/, int idx )
+ {
+     //kdDebug(5006) << "***setEncryptionState1( " << status << " )" << endl;
+-    mDirty = TRUE;
++    mDirty = true;
+     if (storage())
+         storage()->headerOfMsgChanged(this, idx);
+ }
+@@ -325,7 +325,7 @@
+ void KMMsgBase::setSignatureState( const KMMsgSignatureState /*status*/, int idx )
+ {
+     //kdDebug(5006) << "***setSignatureState1( " << status << " )" << endl;
+-    mDirty = TRUE;
++    mDirty = true;
+     if (storage())
+          storage()->headerOfMsgChanged(this, idx);
+ }
+@@ -542,7 +542,7 @@
+   QString str = aStr;
+ 
+   while (str[0] == ' ') str.remove(0,1);
+-  if (hasKeyword) *hasKeyword=FALSE;
++  if (hasKeyword) *hasKeyword=false;
+ 
+   unsigned int strLength(str.length());
+   for (i=0; i < strLength && i < maxChars; i++)
+@@ -555,7 +555,7 @@
+     do {
+       i++;
+     } while (str[i] == ' ');
+-    if (hasKeyword) *hasKeyword=TRUE;
++    if (hasKeyword) *hasKeyword=true;
+     return str.mid(i);
+   }
+   return str;
+@@ -604,7 +604,7 @@
+     {
+       encodings.append(KGlobal::charsets()->languageForEncoding(*it)
+         + " ( " + mimeName + " )");
+-      mimeNames.insert(mimeName, TRUE);
++      mimeNames.insert(mimeName, true);
+     }
+   }
+   encodings.sort();
+@@ -686,7 +686,7 @@
+     if (pos[0]!='=' || pos[1]!='?') {
+       result += LWSP_buffer + pos[0];
+       LWSP_buffer = 0;
+-      lastWasEncodedWord = FALSE;
++      lastWasEncodedWord = false;
+       continue;
+     }
+     // found possible encoded-word
+@@ -789,7 +789,7 @@
+ 
+   unsigned int start, stop, p, pos = 0, encLength;
+   QCString result;
+-  bool breakLine = FALSE;
++  bool breakLine = false;
+   const unsigned int maxLen = 75 - 7 - cset.length();
+ 
+   while (pos < strLength)
+@@ -960,8 +960,8 @@
+       pattern += QString::number(n) + "[*]?";
+     }
+     pattern += "=";
+-    
+-    QRegExp fnamePart( pattern, FALSE );
++
++    QRegExp fnamePart( pattern, false );
+     int startPart = fnamePart.search( aStr );
+     int endPart;
+     found = ( startPart >= 0 );
+@@ -1112,19 +1112,19 @@
+   QString ret;
+ 
+   g_chunk_offset = 0;
+-  bool using_mmap = FALSE;
++  bool using_mmap = false;
+   bool swapByteOrder = storage()->indexSwapByteOrder();
+   if (storage()->indexStreamBasePtr()) {
+     if (g_chunk)
+-	free(g_chunk);
+-    using_mmap = TRUE;
++      free(g_chunk);
++    using_mmap = true;
+     g_chunk = storage()->indexStreamBasePtr() + mIndexOffset;
+     g_chunk_length = mIndexLength;
+   } else {
+     if(!storage()->mIndexStream)
+       return ret;
+     if (g_chunk_length < mIndexLength)
+-	g_chunk = (uchar *)realloc(g_chunk, g_chunk_length = mIndexLength);
++      g_chunk = (uchar *)realloc(g_chunk, g_chunk_length = mIndexLength);
+     off_t first_off=ftell(storage()->mIndexStream);
+     fseek(storage()->mIndexStream, mIndexOffset, SEEK_SET);
+     fread( g_chunk, mIndexLength, 1, storage()->mIndexStream);
+@@ -1181,13 +1181,13 @@
+   off_t ret = 0;
+ 
+   g_chunk_offset = 0;
+-  bool using_mmap = FALSE;
++  bool using_mmap = false;
+   int sizeOfLong = storage()->indexSizeOfLong();
+   bool swapByteOrder = storage()->indexSwapByteOrder();
+   if (storage()->indexStreamBasePtr()) {
+     if (g_chunk)
+       free(g_chunk);
+-    using_mmap = TRUE;
++    using_mmap = true;
+     g_chunk = storage()->indexStreamBasePtr() + mIndexOffset;
+     g_chunk_length = mIndexLength;
+   } else {
+@@ -1371,7 +1371,7 @@
+ bool KMMsgBase::syncIndexString() const
+ {
+   if(!dirty())
+-    return TRUE;
++    return true;
+   int len;
+   const uchar *buffer = asIndexString(len);
+   if (len == mIndexLength) {
+@@ -1379,9 +1379,9 @@
+     fseek(storage()->mIndexStream, mIndexOffset, SEEK_SET);
+     assert( mIndexOffset > 0 );
+     fwrite( buffer, len, 1, storage()->mIndexStream);
+-    return TRUE;
++    return true;
+   }
+-  return FALSE;
++  return false;
+ }
+ 
+ static QStringList sReplySubjPrefixes, sForwardSubjPrefixes;

Added: trunk/packages/kdepim/debian/patches/01_branch_633071_kmail_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_633071_kmail_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_633071_kmail_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,21 @@
+Index: kdepim/kmail/kmfoldermaildir.cpp
+===================================================================
+--- kdepim/kmail/kmfoldermaildir.cpp	(revision 633070)
++++ kdepim/kmail/kmfoldermaildir.cpp	(revision 633071)
+@@ -28,7 +28,6 @@
+ #include <kstaticdeleter.h>
+ #include <kmessagebox.h>
+ 
+-#include <ctype.h>
+ #include <dirent.h>
+ #include <errno.h>
+ #include <stdlib.h>
+@@ -734,7 +733,7 @@
+         int cidx = contentTypeStr.find( "charset=" );
+         if ( cidx != -1 ) {
+           charset = contentTypeStr.mid( cidx + 8 );
+-          if ( charset[0] == '"' ) {
++          if ( !charset.isEmpty() && ( charset[0] == '"' ) ) {
+             charset = charset.mid( 1 );
+           }
+           cidx = 0;

Added: trunk/packages/kdepim/debian/patches/01_branch_643329_imap_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_643329_imap_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_643329_imap_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,24 @@
+Index: kdepim/kmail/kmfolderimap.cpp
+===================================================================
+--- kdepim/kmail/kmfolderimap.cpp	(revision 643193)
++++ kdepim/kmail/kmfolderimap.cpp	(revision 643329)
+@@ -108,14 +108,15 @@
+ //-----------------------------------------------------------------------------
+ void KMFolderImap::close(bool aForced)
+ {
+-  if (mOpenCount <= 0 ) return;
+   if (mOpenCount > 0) mOpenCount--;
+-  if (mOpenCount > 0 && !aForced) return;
+-  if (isSelected() && !aForced) {
++  if (mOpenCount == 0 && isSelected() && !aForced) {
+       kdWarning(5006) << "Trying to close the selected folder " << label() <<
+-          " - ignoring!" << endl;
++        " - ignoring! " << kdBacktrace() << endl;
++      mOpenCount++;
+       return;
+   }
++  if (mOpenCount > 0 && !aForced) return;
++
+   // FIXME is this still needed?
+   if (mAccount)
+     mAccount->ignoreJobsForFolder( folder() );

Added: trunk/packages/kdepim/debian/patches/01_branch_643369_template_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_643369_template_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_643369_template_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,17 @@
+Index: kdepim/kmail/customtemplates.cpp
+===================================================================
+--- kdepim/kmail/customtemplates.cpp	(revision 643368)
++++ kdepim/kmail/customtemplates.cpp	(revision 643369)
+@@ -300,9 +300,10 @@
+   if ( mCurrentItem ) {
+     // mCurrentItem->setText( 0, indexToType( index ) );
+     CustomTemplateItem *vitem = mItemList[ mCurrentItem->text( 1 ) ];
+-    if ( vitem ) {
+-      vitem->mType = static_cast<Type>(index);
++    if ( !vitem ) {
++      return;
+     }
++    vitem->mType = static_cast<Type>(index);
+     switch ( vitem->mType ) {
+     case TReply:
+       mCurrentItem->setPixmap( 0, mReplyPix );

Added: trunk/packages/kdepim/debian/patches/01_branch_644873_fix_open_count.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_644873_fix_open_count.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_644873_fix_open_count.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,249 @@
+Index: kdepim/kmail/kmailicalifaceimpl.cpp
+===================================================================
+--- kdepim/kmail/kmailicalifaceimpl.cpp	(revision 644872)
++++ kdepim/kmail/kmailicalifaceimpl.cpp	(revision 644873)
+@@ -555,6 +555,7 @@
+ #endif
+     }
+   }
++  f->close();
+   return aMap;
+ }
+ 
+Index: kdepim/kmail/kmheaders.cpp
+===================================================================
+--- kdepim/kmail/kmheaders.cpp	(revision 644872)
++++ kdepim/kmail/kmheaders.cpp	(revision 644873)
+@@ -15,6 +15,7 @@
+ #include "kmmsgdict.h"
+ #include "kmdebug.h"
+ #include "kmfoldertree.h"
++#include "kmfolderimap.h"
+ #include "folderjob.h"
+ using KMail::FolderJob;
+ #include "actionscheduler.h"
+@@ -215,6 +216,11 @@
+   {
+     writeFolderConfig();
+     writeSortOrder();
++    if (mFolder->folderType() == KMFolderTypeImap)
++    {
++      KMFolderImap *imap = static_cast<KMFolderImap*>(mFolder->storage());
++      imap->setSelected( false );
++    }
+     mFolder->close();
+   }
+   writeConfig();
+Index: kdepim/kmail/kmmainwidget.cpp
+===================================================================
+--- kdepim/kmail/kmmainwidget.cpp	(revision 644872)
++++ kdepim/kmail/kmmainwidget.cpp	(revision 644873)
+@@ -164,6 +164,7 @@
+   mJob = 0;
+   mConfig = config;
+   mGUIClient = aGUIClient;
++  mOpenedImapFolder = false;
+ 
+   mCustomReplyActionMenu = 0;
+   mCustomReplyAllActionMenu = 0;
+@@ -1875,8 +1876,11 @@
+   folderSelected( mFolder );
+   updateFolderMenu();
+   // opened() before the getAndCheckFolder() in folderSelected
+-  if ( mFolder && mFolder->folderType() == KMFolderTypeImap )
++  if ( mFolder && mFolder->folderType() == KMFolderTypeImap && mOpenedImapFolder )
++  {
+     mFolder->close();
++    mOpenedImapFolder = false;
++  }
+ }
+ 
+ //-----------------------------------------------------------------------------
+@@ -1930,7 +1934,13 @@
+            this, SLOT( updateMarkAsReadAction() ) );
+     disconnect( mFolder, SIGNAL( msgRemoved( KMFolder * ) ),
+            this, SLOT( updateMarkAsReadAction() ) );
++    if ( mOpenedImapFolder && newFolder && mFolder->folderType() == KMFolderTypeImap ) {
++      mFolder->close();
++      KMFolderImap *imap = static_cast<KMFolderImap*>(mFolder->storage());
++      imap->setSelected( false );
++      mOpenedImapFolder = false;
+   }
++  }
+ 
+   mFolder = aFolder;
+ 
+@@ -1944,6 +1954,7 @@
+     if ( newFolder && !mFolder->noContent() )
+     {
+       imap->open(); // will be closed in the folderSelected slot
++      mOpenedImapFolder = true;
+       // first get new headers before we select the folder
+       imap->setSelected( true );
+       connect( imap, SIGNAL( folderComplete( KMFolderImap*, bool ) ),
+Index: kdepim/kmail/kmcomposewin.cpp
+===================================================================
+--- kdepim/kmail/kmcomposewin.cpp	(revision 644872)
++++ kdepim/kmail/kmcomposewin.cpp	(revision 644873)
+@@ -3928,12 +3928,11 @@
+   if ( imapTheFolder && imapTheFolder->noContent() )
+     imapTheFolder = 0;
+ 
+-  if ( theFolder == 0 ) {
++  if ( theFolder == 0 )
+     theFolder = ( mSaveIn==KMComposeWin::Drafts ?
+                   kmkernel->draftsFolder() : kmkernel->templatesFolder() );
+-  } else {
+-    theFolder->open();
+-  }
++
++  theFolder->open();
+   kdDebug(5006) << k_funcinfo << "theFolder=" << theFolder->name() << endl;
+   if ( imapTheFolder )
+     kdDebug(5006) << k_funcinfo << "imapTheFolder=" << imapTheFolder->name() << endl;
+@@ -3951,6 +3950,7 @@
+     (static_cast<KMFolderImap*>( imapTheFolder->storage() ))->getFolder();
+   }
+ 
++  theFolder->close();
+   return sentOk;
+ }
+ 
+Index: kdepim/kmail/kmfolderimap.cpp
+===================================================================
+--- kdepim/kmail/kmfolderimap.cpp	(revision 644872)
++++ kdepim/kmail/kmfolderimap.cpp	(revision 644873)
+@@ -695,7 +695,6 @@
+         KMFolderImap* f = static_cast<KMFolderImap*> ( fld->storage() );
+         f->initializeFrom( this, mAccount->addPathToNamespace( name ),
+             "inode/directory" );
+-        f->close();
+         if ( !mAccount->listOnlyOpenFolders() )
+         {
+           f->slotListResult( subfolderNames, subfolderPaths,
+@@ -811,7 +810,6 @@
+       KMFolder *fld = folder()->child()->createFolder(subfolderNames[i]);
+       if ( fld ) {
+         f = static_cast<KMFolderImap*> ( fld->storage() );
+-        f->close();
+         settingsChanged = true;
+       } else {
+         kdWarning(5006) << "can't create folder " << subfolderNames[i] << endl;
+@@ -876,7 +874,6 @@
+     if ( f )
+     {
+       f->folder()->setLabel( i18n("inbox") );
+-      f->close();
+     }
+     kmkernel->imapFolderMgr()->contentsChanged();
+   }
+@@ -996,7 +993,6 @@
+ {
+   if (!mAccount) {
+     emit folderComplete(this, false);
+-    close();
+     return;
+   }
+   KURL url = mAccount->getUrl();
+@@ -1012,7 +1008,6 @@
+     kdDebug(5006) << "KMFolderImap::checkValidity - got no connection" << endl;
+     emit folderComplete(this, FALSE);
+     mContentState = imapNoInformation;
+-    close();
+     return;
+   } else if ( connectionState == ImapAccountBase::Connecting ) {
+     // We'll wait for the connectionResult signal from the account. If it
+@@ -1025,7 +1020,6 @@
+   // Only check once at a time.
+   if (mCheckingValidity) {
+     kdDebug(5006) << "KMFolderImap::checkValidity - already checking" << endl;
+-    close();
+     return;
+   }
+   // otherwise we already are inside a mailcheck
+@@ -1045,6 +1039,7 @@
+   if ( account()->mailCheckProgressItem() ) {
+     account()->mailCheckProgressItem()->setStatus( folder()->prettyURL() );
+   }
++  open();
+   ImapAccountBase::jobData jd( url.url() );
+   KIO::SimpleJob *job = KIO::get(url, FALSE, FALSE);
+   KIO::Scheduler::assignJobToSlave(mAccount->slave(), job);
+@@ -1144,6 +1139,7 @@
+       mMailCheckProgressItem->setCompletedItems( 0 );
+     }
+     reallyGetFolder(startUid);
++    close();
+   }
+ }
+ 
+@@ -1178,6 +1174,7 @@
+     mCheckFlags = TRUE;
+   }
+   checkValidity();
++  close();
+ }
+ 
+ 
+@@ -1189,7 +1186,6 @@
+   {
+     mContentState = imapNoInformation;
+     emit folderComplete(this, FALSE);
+-    close();
+     return;
+   }
+   quiet(true);
+@@ -1199,6 +1195,7 @@
+       mMailCheckProgressItem->setStatus( i18n("Retrieving message status") );
+     url.setPath(imapPath() + ";SECTION=UID FLAGS");
+     KIO::SimpleJob *job = KIO::listDir(url, FALSE);
++    open();
+     KIO::Scheduler::assignJobToSlave(mAccount->slave(), job);
+     ImapAccountBase::jobData jd( url.url(), folder() );
+     jd.cancellable = true;
+@@ -1218,6 +1215,7 @@
+     KIO::Scheduler::assignJobToSlave(mAccount->slave(), newJob);
+     ImapAccountBase::jobData jd( url.url(), folder() );
+     jd.cancellable = true;
++    open();
+     mAccount->insertJob(newJob, jd);
+     connect(newJob, SIGNAL(result(KIO::Job *)),
+             this, SLOT(slotGetLastMessagesResult(KIO::Job *)));
+@@ -1310,6 +1308,9 @@
+   else sets = makeSets( (*it).items );
+   mAccount->removeJob(it); // don't use *it below
+ 
++  if ( sets.isEmpty() )
++    close();
++
+   // Now kick off the getting of envelopes for the new mails in the folder
+   for (QStringList::Iterator i = sets.begin(); i != sets.end(); ++i)
+   {
+@@ -1812,6 +1813,7 @@
+ 
+ void KMFolderImap::setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle)
+ {
++  open();
+   FolderStorage::setStatus(ids, status, toggle);
+   if (mReadOnly) return;
+ 
+@@ -1855,6 +1857,7 @@
+     quiet( false );
+     reallyGetFolder( QString::null );
+   }
++  close();
+ }
+ 
+ //-----------------------------------------------------------------------------
+Index: kdepim/kmail/kmmainwidget.h
+===================================================================
+--- kdepim/kmail/kmmainwidget.h	(revision 644872)
++++ kdepim/kmail/kmmainwidget.h	(revision 644873)
+@@ -531,6 +531,7 @@
+   KXMLGUIClient *mGUIClient;
+ 
+   static QValueList<KMMainWidget*>* s_mainWidgetList;
++  bool mOpenedImapFolder;
+ };
+ 
+ #endif

Added: trunk/packages/kdepim/debian/patches/01_branch_644877_dont_crash_if_folders_are_deleted.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_644877_dont_crash_if_folders_are_deleted.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_644877_dont_crash_if_folders_are_deleted.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,22 @@
+Index: kdepim/kmail/kmacctimap.cpp
+===================================================================
+--- kdepim/kmail/kmacctimap.cpp	(revision 644876)
++++ kdepim/kmail/kmacctimap.cpp	(revision 644877)
+@@ -342,7 +342,7 @@
+         else {
+           connect(imapFolder, SIGNAL(numUnreadMsgsChanged(KMFolder*)),
+               this, SLOT(postProcessNewMail(KMFolder*)));
+-          bool ok = imapFolder->processNewMail(interactive);
++          bool ok = imapFolder->processNewMail(interactive); // this removes the local kmfolderimap if its imapPath is somehow empty, and removing it calls createFolderList, invalidating mMailCheckFolders, and causing a crash
+           if (!ok)
+           {
+             // there was an error so cancel
+@@ -352,6 +352,8 @@
+               mMailCheckProgressItem->incCompletedItems();
+               mMailCheckProgressItem->updateProgress();
+             }
++            // since the list of folders might have been updated at this point, mMailCheckFolders may be invalid, so break
++            break;
+           }
+         }
+       }

Added: trunk/packages/kdepim/debian/patches/01_branch_644897_fix_imap_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_644897_fix_imap_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_644897_fix_imap_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,14 @@
+Index: kdepim/kmail/kmfolderimap.cpp
+===================================================================
+--- kdepim/kmail/kmfolderimap.cpp	(revision 644896)
++++ kdepim/kmail/kmfolderimap.cpp	(revision 644897)
+@@ -917,6 +917,9 @@
+     const QString& myNamespace )
+ {
+   QPtrList<KMFolder> toRemove;
++  if (!folder()->child())
++    return;
++    
+   KMFolderNode *node = folder()->child()->first();
+   while ( node )
+   {

Added: trunk/packages/kdepim/debian/patches/01_branch_644903_fix_folder_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_644903_fix_folder_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_644903_fix_folder_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,13 @@
+Index: kdepim/kmail/kmmainwidget.cpp
+===================================================================
+--- kdepim/kmail/kmmainwidget.cpp	(revision 644902)
++++ kdepim/kmail/kmmainwidget.cpp	(revision 644903)
+@@ -854,7 +854,7 @@
+ 
+     KMFolder *folder = kmkernel->findFolderById( *it );
+ 
+-    if ( !folder->ignoreNewMail() ) {
++    if ( folder && !folder->ignoreNewMail() ) {
+       showNotification = true;
+       if ( GlobalSettings::self()->verboseNewMailNotification() ) {
+         summary += "<br>" + i18n( "1 new message in %1",

Added: trunk/packages/kdepim/debian/patches/01_branch_644988_fix_imap_account_creation_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_644988_fix_imap_account_creation_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_644988_fix_imap_account_creation_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,15 @@
+Index: kdepim/kmail/accountwizard.cpp
+===================================================================
+--- kdepim/kmail/accountwizard.cpp	(revision 644987)
++++ kdepim/kmail/accountwizard.cpp	(revision 644988)
+@@ -491,7 +491,10 @@
+ void AccountWizard::accountCreated()
+ {
+   if ( mAccount )
++  {
+     mKernel->acctMgr()->add( mAccount );
++    mKernel->cleanupImapFolders();
++  }
+ 
+   finished();
+ }

Added: trunk/packages/kdepim/debian/patches/01_branch_645047_kmail_crash_gpg_related.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_645047_kmail_crash_gpg_related.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_645047_kmail_crash_gpg_related.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,118 @@
+Index: kdepim/kmail/kmheaders.cpp
+===================================================================
+--- kdepim/kmail/kmheaders.cpp	(revision 645046)
++++ kdepim/kmail/kmheaders.cpp	(revision 645047)
+@@ -1731,6 +1731,9 @@
+ 
+ void KMHeaders::selectNextMessage()
+ {
++  KMMessage *cm = currentMsg();
++  if ( cm && cm->isBeingParsed() )
++    return;
+   QListViewItem *lvi = currentItem();
+   if( lvi ) {
+     QListViewItem *below = lvi->itemBelow();
+@@ -1765,6 +1768,9 @@
+ 
+ void KMHeaders::selectPrevMessage()
+ {
++  KMMessage *cm = currentMsg();
++  if ( cm && cm->isBeingParsed() )
++    return;
+   QListViewItem *lvi = currentItem();
+   if( lvi ) {
+     QListViewItem *above = lvi->itemAbove();
+@@ -1788,6 +1794,9 @@
+ 
+ void KMHeaders::incCurrentMessage()
+ {
++  KMMessage *cm = currentMsg();
++  if ( cm && cm->isBeingParsed() )
++    return;
+   QListViewItem *lvi = currentItem();
+   if ( lvi && lvi->itemBelow() ) {
+ 
+@@ -1803,6 +1812,9 @@
+ 
+ void KMHeaders::decCurrentMessage()
+ {
++  KMMessage *cm = currentMsg();
++  if ( cm && cm->isBeingParsed() )
++    return;
+   QListViewItem *lvi = currentItem();
+   if ( lvi && lvi->itemAbove() ) {
+     disconnect(this,SIGNAL(currentChanged(QListViewItem*)),
+Index: kdepim/kmail/kmmessage.h
+===================================================================
+--- kdepim/kmail/kmmessage.h	(revision 645046)
++++ kdepim/kmail/kmmessage.h	(revision 645047)
+@@ -855,6 +855,12 @@
+   /** Set cursor position as offset from message start */
+   void setCursorPos(int pos) { mCursorPos = pos; };
+ 
++  /* This is set in kmreaderwin if a message is being parsed to avoid
++     other parts of kmail (e.g. kmheaders) destroying the message. 
++     Parsing can take longer and can be async (in case of gpg mails) */
++  bool isBeingParsed() const { return mIsParsed; }
++  void setIsBeingParsed( bool t ) { mIsParsed = t; }
++
+ private:
+ 
+   /** Initialization shared by the ctors. */
+@@ -869,6 +875,7 @@
+   bool mDecodeHTML :1;
+   bool mReadyToShow :1;
+   bool mComplete :1;
++  bool mIsParsed : 1;
+   static const KMail::HeaderStrategy * sHeaderStrategy;
+   static QString sForwardStr;
+   const QTextCodec * mOverrideCodec;
+Index: kdepim/kmail/kmreaderwin.cpp
+===================================================================
+--- kdepim/kmail/kmreaderwin.cpp	(revision 645046)
++++ kdepim/kmail/kmreaderwin.cpp	(revision 645047)
+@@ -1504,7 +1504,14 @@
+ 
+   assert(aMsg!=0);
+ 
+-  delete mRootNode;
++  aMsg->setIsBeingParsed( true );
++
++  if ( mRootNode && !mRootNode->processed() )
++  {
++    kdWarning() << "The root node is not yet processed! Danger!\n";
++    return;
++  } else
++    delete mRootNode;
+   mRootNode = partNode::fromMessage( aMsg );
+   const QCString mainCntTypeStr = mRootNode->typeString() + '/' + mRootNode->subTypeString();
+ 
+@@ -1642,6 +1649,8 @@
+     showHideMimeTree( rootNodeCntType == DwMime::kTypeText &&
+ 		      rootNodeCntSubtype == DwMime::kSubtypePlain );
+   }
++
++  aMsg->setIsBeingParsed( false );
+ }
+ 
+ 
+Index: kdepim/kmail/kmmessage.cpp
+===================================================================
+--- kdepim/kmail/kmmessage.cpp	(revision 645046)
++++ kdepim/kmail/kmmessage.cpp	(revision 645047)
+@@ -152,6 +152,7 @@
+   mUnencryptedMsg = 0;
+   mLastUpdated = 0;
+   mCursorPos = 0;
++  mIsParsed = false;
+ }
+ 
+ void KMMessage::assign( const KMMessage& other )
+@@ -174,6 +175,7 @@
+   mEncryptionState = other.mEncryptionState;
+   mSignatureState = other.mSignatureState;
+   mMDNSentState = other.mMDNSentState;
++  mIsParsed = other.mIsParsed;
+   mDate    = other.mDate;
+   if( other.hasUnencryptedMsg() )
+     mUnencryptedMsg = new KMMessage( *other.unencryptedMsg() );

Added: trunk/packages/kdepim/debian/patches/01_branch_645389_kmail_crash_delete_imap.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_645389_kmail_crash_delete_imap.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_645389_kmail_crash_delete_imap.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,69 @@
+Index: kdepim/kmail/imapjob.cpp
+===================================================================
+--- kdepim/kmail/imapjob.cpp	(revision 645388)
++++ kdepim/kmail/imapjob.cpp	(revision 645389)
+@@ -502,6 +502,12 @@
+ void ImapJob::slotPutMessageDataReq( KIO::Job *job, QByteArray &data )
+ {
+   KMAcctImap *account = static_cast<KMFolderImap*>(mDestFolder->storage())->account();
++  if ( !account )
++  {
++    emit finished();
++    deleteLater();
++    return;
++  }
+   ImapAccountBase::JobIterator it = account->findJob( job );
+   if ( it == account->jobsEnd() ) return;
+ 
+@@ -522,6 +528,12 @@
+ void ImapJob::slotPutMessageResult( KIO::Job *job )
+ {
+   KMAcctImap *account = static_cast<KMFolderImap*>(mDestFolder->storage())->account();
++  if ( !account )
++  {
++    emit finished();
++    deleteLater();
++    return;
++  }
+   ImapAccountBase::JobIterator it = account->findJob( job );
+   if ( it == account->jobsEnd() ) return;
+   bool deleteMe = false;
+@@ -562,6 +574,12 @@
+ {
+   KMFolderImap * imapFolder = static_cast<KMFolderImap*>(mDestFolder->storage());
+   KMAcctImap *account = imapFolder->account();
++  if ( !account )
++  {
++    emit finished();
++    deleteLater();
++    return;
++  }
+   ImapAccountBase::JobIterator it = account->findJob( job );
+   if ( it == account->jobsEnd() ) return;
+ 
+@@ -595,6 +613,12 @@
+ {
+   KMFolderImap * imapFolder = static_cast<KMFolderImap*>(mDestFolder->storage());
+   KMAcctImap *account = imapFolder->account();
++  if ( !account )
++  {
++    emit finished();
++    deleteLater();
++    return;
++  }
+   ImapAccountBase::JobIterator it = account->findJob( job );
+   if ( it == account->jobsEnd() ) return;
+ 
+@@ -613,6 +637,12 @@
+ void ImapJob::slotCopyMessageResult( KIO::Job *job )
+ {
+   KMAcctImap *account = static_cast<KMFolderImap*>(mDestFolder->storage())->account();
++  if ( !account )
++  {
++    emit finished();
++    deleteLater();
++    return;
++  }
+   ImapAccountBase::JobIterator it = account->findJob( job );
+   if ( it == account->jobsEnd() ) return;
+ 

Added: trunk/packages/kdepim/debian/patches/01_branch_645673_ensure_main_widget.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_645673_ensure_main_widget.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_645673_ensure_main_widget.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,20 @@
+Index: kdepim/kmail/kmkernel.cpp
+===================================================================
+--- kdepim/kmail/kmkernel.cpp	(revision 645672)
++++ kdepim/kmail/kmkernel.cpp	(revision 645680)
+@@ -1952,6 +1952,15 @@
+              this, SLOT( slotConfigChanged() ) );
+   }
+ 
++  if( KMKernel::getKMMainWidget() == 0 )
++  {
++    // ensure that there is a main widget available
++    // as parts of the configure dialog (identity) rely on this
++    // and this slot can be called when there is only a KMComposeWin showing
++    KMMainWin * win = new KMMainWin;
++    win->show();
++  }
++
+   if( mConfigureDialog->isHidden() )
+     mConfigureDialog->show();
+   else

Added: trunk/packages/kdepim/debian/patches/01_branch_645830_dont_crash_if_folder_gone.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_645830_dont_crash_if_folder_gone.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_645830_dont_crash_if_folder_gone.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,16 @@
+Index: kdepim/kmail/kmfilteraction.cpp
+===================================================================
+--- kdepim/kmail/kmfilteraction.cpp	(revision 645829)
++++ kdepim/kmail/kmfilteraction.cpp	(revision 645830)
+@@ -1378,8 +1378,10 @@
+   // TODO opening and closing the folder is a trade off.
+   // Perhaps Copy is a seldomly used action for now,
+   // but I gonna look at improvements ASAP.
+-  if ( !mFolder && mFolder->open() != 0 )
++  if ( !mFolder )
+     return ErrorButGoOn;
++  if ( mFolder && mFolder->open() != 0 )
++    return ErrorButGoOn;
+ 
+   // copy the message 1:1
+   KMMessage* msgCopy = new KMMessage( new DwMessage( *msg->asDwMessage() ) );

Added: trunk/packages/kdepim/debian/patches/01_branch_649334_fix_kmail_folder_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_649334_fix_kmail_folder_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_649334_fix_kmail_folder_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,25 @@
+Index: kdepim/kmail/kmfolderimap.cpp
+===================================================================
+--- kdepim/kmail/kmfolderimap.cpp	(revision 649333)
++++ kdepim/kmail/kmfolderimap.cpp	(revision 649334)
+@@ -133,6 +133,9 @@
+           msg->setTransferInProgress( false );
+     }
+   }
++
++  mCheckingValidity = false;
++
+   // The inherited close will decrement again, so we have to adjust.
+   mOpenCount++;
+   KMFolderMbox::close(owner, aForced);
+@@ -1109,6 +1112,10 @@
+ //-----------------------------------------------------------------------------
+ void KMFolderImap::slotCheckValidityResult(KIO::Job * job)
+ {
++  // if we closed the folder in between, we don't want this results
++  if (!mCheckingValidity)
++    return;
++
+   kdDebug(5006) << "KMFolderImap::slotCheckValidityResult of: " << fileName() << endl;
+   mCheckingValidity = false;
+   ImapAccountBase::JobIterator it = account()->findJob(job);

Added: trunk/packages/kdepim/debian/patches/01_branch_649957_guard_possible_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_649957_guard_possible_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_649957_guard_possible_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,89 @@
+Index: kdepim/kmail/actionscheduler.cpp
+===================================================================
+--- kdepim/kmail/actionscheduler.cpp	(revision 649956)
++++ kdepim/kmail/actionscheduler.cpp	(revision 649957)
+@@ -170,7 +170,7 @@
+ {
+   mFiltersAreQueued = true;
+   mQueuedFilters.clear();
+-  
++
+   QValueList<KMFilter*>::Iterator it = filters.begin();
+   for (; it != filters.end(); ++it)
+     mQueuedFilters.append( **it );
+@@ -231,7 +231,7 @@
+ void ActionScheduler::execFilters(Q_UINT32 serNum)
+ {
+   if (mResult != ResultOk) {
+-      if ((mResult != ResultCriticalError) && 
++      if ((mResult != ResultCriticalError) &&
+ 	  !mExecuting && !mExecutingLock && !mFetchExecuting) {
+ 	  mResult = ResultOk; // Recoverable error
+ 	  if (!mFetchSerNums.isEmpty()) {
+@@ -420,10 +420,10 @@
+       fetchMessageTimer->start( 0, true );
+       return;
+   }
+-	
++
+   mFetchSerNums.remove( msg->getMsgSerNum() );
+ 
+-  // Note: This may not be necessary. What about when it's time to 
++  // Note: This may not be necessary. What about when it's time to
+   //       delete the original message?
+   //       Is the new serial number being set correctly then?
+   if ((mSet & KMFilterMgr::Explicit) ||
+@@ -500,7 +500,7 @@
+ 
+   //If we got this far then there's a valid message to work with
+   KMMsgBase *msgBase = messageBase( *mMessageIt );
+-  if (mResult != ResultOk) {
++  if (!msgBase || mResult != ResultOk) {
+     mExecuting = false;
+     return;
+   }
+@@ -580,7 +580,7 @@
+     if (mAlwaysMatch ||
+ 	(*mFilterIt).pattern()->matches( *mMessageIt )) {
+       if ( FilterLog::instance()->isLogging() ) {
+-        FilterLog::instance()->add( i18n( "<b>Filter rules have matched.</b>" ), 
++        FilterLog::instance()->add( i18n( "<b>Filter rules have matched.</b>" ),
+                                     FilterLog::patternResult );
+       }
+       mFilterAction = (*mFilterIt).actions()->first();
+@@ -694,7 +694,7 @@
+     msg = message( mOriginalSerNum );
+     emit filtered( mOriginalSerNum );
+   }
+-  
++
+   mResult = mOldReturnCode; // ignore errors in deleting original message
+   KMCommand *cmd = 0;
+   if (msg && msg->parent()) {
+@@ -710,7 +710,7 @@
+     else
+ 	processMessageTimer->start( 0, true );
+   } else {
+-    // Note: An alternative to consider is just calling 
++    // Note: An alternative to consider is just calling
+     //       finishTimer->start and returning
+     if (cmd)
+ 	connect( cmd, SIGNAL( completed( KMCommand * ) ),
+@@ -727,7 +727,7 @@
+ {
+   if ( command->result() != KMCommand::OK )
+     actionMessage( KMFilterAction::ErrorButGoOn );
+-  else 
++  else
+     actionMessage();
+ }
+ 
+@@ -786,7 +786,7 @@
+ 	    res.append( QString( "ResultCriticalError.\n" ) );
+ 	else
+ 	    res.append( QString( "Unknown.\n" ) );
+-	    
++
+ 	++i;
+     }
+     return res;

Added: trunk/packages/kdepim/debian/patches/01_branch_650978_guard_more_crash.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_650978_guard_more_crash.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_650978_guard_more_crash.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,95 @@
+Index: kdepim/kmail/kmcommands.cpp
+===================================================================
+--- kdepim/kmail/kmcommands.cpp	(revision 650977)
++++ kdepim/kmail/kmcommands.cpp	(revision 650978)
+@@ -481,6 +481,9 @@
+ {
+   //TODO : consider factoring createReply into this method.
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *rmsg = msg->createReply( KMail::ReplyNone, mSelection );
+   rmsg->setTo( KMMessage::decodeMailtoUrl( mUrl.path() ) );
+ 
+@@ -503,6 +506,9 @@
+ {
+   //TODO : consider factoring createForward into this method.
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *fmsg = msg->createForward();
+   fmsg->setTo( KMMessage::decodeMailtoUrl( mUrl.path() ) );
+ 
+@@ -712,6 +718,9 @@
+ KMCommand::Result KMShowMsgSrcCommand::execute()
+ {
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   if ( msg->isComplete() && !mMsgWasComplete )
+     msg->notify(); // notify observers as msg was transfered
+   QString str = msg->codec()->toUnicode( msg->asString() );
+@@ -1062,6 +1071,9 @@
+ {
+   KCursorSaver busy(KBusyPtr::busy());
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *reply = msg->createReply( KMail::ReplySmart, mSelection );
+   KMail::Composer * win = KMail::makeComposer( reply );
+   win->setCharset( msg->codec()->mimeName(), TRUE );
+@@ -1082,6 +1094,9 @@
+ {
+   KCursorSaver busy(KBusyPtr::busy());
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *reply = msg->createReply( KMail::ReplySmart, "", TRUE);
+   KMail::Composer * win = KMail::makeComposer( reply );
+   win->setCharset(msg->codec()->mimeName(), TRUE);
+@@ -1102,6 +1117,9 @@
+ {
+   KCursorSaver busy(KBusyPtr::busy());
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *reply = msg->createReply( KMail::ReplyList, mSelection);
+   KMail::Composer * win = KMail::makeComposer( reply );
+   win->setCharset(msg->codec()->mimeName(), TRUE);
+@@ -1423,6 +1441,9 @@
+ {
+   KCursorSaver busy(KBusyPtr::busy());
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *reply = msg->createReply( KMail::ReplySmart, mSelection,
+                                        false, true, false, mTemplate );
+   KMail::Composer * win = KMail::makeComposer( reply );
+@@ -1445,6 +1466,9 @@
+ {
+   KCursorSaver busy(KBusyPtr::busy());
+   KMMessage *msg = retrievedMessage();
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *reply = msg->createReply( KMail::ReplyAll, mSelection,
+                                        false, true, false, mTemplate );
+   KMail::Composer * win = KMail::makeComposer( reply );
+@@ -2761,7 +2785,9 @@
+ KMCommand::Result KMResendMessageCommand::execute()
+ {
+   KMMessage *msg = retrievedMessage();
+-
++  if ( !msg || !msg->codec() ) {
++    return Failed;
++  }
+   KMMessage *newMsg = new KMMessage(*msg);
+   newMsg->setCharset(msg->codec()->mimeName());
+   // the message needs a new Message-Id

Added: trunk/packages/kdepim/debian/patches/01_branch_650987_fix_crash_creating_index.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_branch_650987_fix_crash_creating_index.diff	2007-04-13 07:57:01 UTC (rev 5892)
+++ trunk/packages/kdepim/debian/patches/01_branch_650987_fix_crash_creating_index.diff	2007-04-13 12:32:16 UTC (rev 5893)
@@ -0,0 +1,13 @@
+Index: kdepim/kmail/kmfoldermbox.cpp
+===================================================================
+--- kdepim/kmail/kmfoldermbox.cpp	(revision 650986)
++++ kdepim/kmail/kmfoldermbox.cpp	(revision 650987)
+@@ -668,7 +668,7 @@
+             int cidx = contentTypeStr.find( "charset=" );
+             if ( cidx != -1 ) {
+               charset = contentTypeStr.mid( cidx + 8 );
+-              if ( charset[0] == '"' ) {
++              if ( !charset.isEmpty() && ( charset[0] == '"' ) ) {
+                 charset = charset.mid( 1 );
+               }
+               cidx = 0;




More information about the pkg-kde-commits mailing list