Bug#404032: kmail: crash when filtering mails into current folder
Package: kmail
Version: 4:3.5.5.dfsg.1-6
Followup-For: Bug #404032
It looks like kmail does not honour multiple opens of the same mailbox
thus closing the current mailbox unmindful and crashes.
the attached (dirty) patch avoids closing a folder if already open.
-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'testing-proposed-updates'), (500, 'testing')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.19.2-R52
Locale: LANG=C, LC_CTYPE=de_DE@euro (charmap=ISO-8859-15)
Versions of packages kmail depends on:
ii kdebase-kio-plugins 4:3.5.5a.dfsg.1-5 core I/O slaves for KDE
ii kdelibs4c2a 4:3.5.5a.dfsg.1-5 core libraries and binaries for al
ii kdepim-kio-plugins 4:3.5.5.dfsg.1-6 KDE pim I/O Slaves
ii libart-2.0-2 2.3.17-1 Library of functions for 2D graphi
ii libaudio2 1.8-2 The Network Audio System (NAS). (s
ii libc6 2.3.6.ds1-10 GNU C Library: Shared libraries
ii libfontconfig1 2.4.2-1 generic font configuration library
ii libfreetype6 2.2.1-5 FreeType 2 font engine, shared lib
ii libgcc1 1:4.1.1-21 GCC support library
ii libice6 1:1.0.1-2 X11 Inter-Client Exchange library
ii libidn11 0.6.5-1 GNU libidn library, implementation
ii libjpeg62 6b-13 The Independent JPEG Group's JPEG
ii libkcal2b 4:3.5.5.dfsg.1-6 KDE calendaring library
ii libkdepim1a 4:3.5.5.dfsg.1-6 KDE PIM library
ii libkleopatra1 4:3.5.5.dfsg.1-6 KDE GnuPG interface libraries
ii libkmime2 4:3.5.5.dfsg.1-6 KDE MIME interface library
ii libkpimidentities1 4:3.5.5.dfsg.1-6 KDE PIM user identity information
ii libksieve0 4:3.5.5.dfsg.1-6 KDE mail/news message filtering li
ii libmimelib1c2a 4:3.5.5.dfsg.1-6 KDE mime library
ii libpng12-0 1.2.15~beta5-1 PNG library - runtime
ii libqt3-mt 3:3.3.7-3 Qt GUI Library (Threaded runtime v
ii libsm6 1:1.0.1-3 X11 Session Management library
ii libstdc++6 4.1.1-21 The GNU Standard C++ Library v3
ii libx11-6 2:1.0.3-5 X11 client-side library
ii libxcursor1 1.1.7-4 X cursor management library
ii libxext6 1:1.0.1-2 X11 miscellaneous extension librar
ii libxft2 2.1.8.2-8 FreeType-based font drawing librar
ii libxi6 1:1.0.1-4 X11 Input extension library
ii libxinerama1 1:1.0.1-4.1 X11 Xinerama extension library
ii libxrandr2 2:1.1.0.2-5 X11 RandR extension library
ii libxrender1 1:0.9.1-3 X Rendering Extension client libra
ii libxt6 1:1.0.2-2 X11 toolkit intrinsics library
ii perl 5.8.8-7 Larry Wall's Practical Extraction
ii zlib1g 1:1.2.3-13 compression library - runtime
Versions of packages kmail recommends:
ii procmail 3.22-16 Versatile e-mail processor
-- no debconf information
Index: kmail/kmfilteraction.cpp
===================================================================
--- kdepim/kmail/kmfilteraction.cpp (revision 539146)
+++ kdepim/kmail/kmfilteraction.cpp (working copy)
@@ -1373,12 +1373,21 @@
KMFilterAction::ReturnCode KMFilterActionCopy::process(KMMessage* msg) const
{
+ bool opened = false;
+
// 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 )
- return ErrorButGoOn;
-
+ if ( !mFolder ) {
+ if (!mFolder->isOpened()) {
+ int rc;
+ opened = true;
+ rc = mFolder->open();
+ kdDebug(5006) << "KMFolderMaildir::addMsg-open: " << rc << " of folder: " << label() << endl;
+ if (rc) return ErrorButGoOn;
+ }
+ }
+
// copy the message 1:1
KMMessage* msgCopy = new KMMessage;
msgCopy->fromDwString(msg->asDwString());
@@ -1387,8 +1396,9 @@
int rc = mFolder->addMsg(msgCopy, &index);
if (rc == 0 && index != -1)
mFolder->unGetMsg( index );
- mFolder->close();
+ if (opened) mFolder->close();
+
return GoOn;
}
Reply to: