[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    [PATCH][TRIVIAL] Crash during a "insert file" in the composer [BUG
From:       Goffredo Baroncelli <kreijack () alice ! it>
Date:       2006-01-07 18:13:57
Message-ID: 200601071914.05250.kreijack () alice ! it
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Hi all, and happy new year

As also reported in the bugs 
- 111383: kmail crashes while inserting files, 
- 108063: kmail composer crashes when inserting file, 
- 111713: kmail crashes when inserting files 
I discovered that sometime the kmail composer crash when an user try to 
insert a file via the menu edit->insert file.

Looking the code I noted the following lines

( file kdepim/kmail/kmcomposewin.cpp, function void KMComposeWin::slotInsertFile(), \
line ~2660)

ghigo@therra:~/kmail/kdepim-3.5.0/kmail$ grep -n -B8  "urls.erase( \
encodings.fromLast() );" kmcomposewin.cpp 2652-    QStringList urls = \
config->readListEntry( "recent-urls" ); 2653-    QStringList encodings = \
config->readListEntry( "recent-encodings" ); 2654-    // Prevent config file from \
growing without bound 2655-    // Would be nicer to get this constant from \
KRecentFilesAction 2656-    uint mMaxRecentFiles = 30;
2657-    while (urls.count() > mMaxRecentFiles)
2658-      urls.erase( urls.fromLast() );
2659-    while (encodings.count() > mMaxRecentFiles)
2660:      urls.erase( encodings.fromLast() );

Note the line 2660: the code remove an item from the 'urls' list on the
basis of an iterator which comes from the the 'encoding' list !!!. I think that
the 'urls' variable have to be replaced by 'encodings'.
The patch below correct this, and should solve the bugs above: the crash happens only \
when there are more than 30 items in the encodings lists and this seems coherent with \
which is described in the bugs report. 

--- kdepim-3.5.0/kmail/kmcomposewin.cpp 2005-10-10 17:02:11.000000000 +0200
+++ kdepim-3.5.0/kmail/kmcomposewin.cpp-new     2006-01-07 18:49:06.000000000 +0100
@@ -2657,7 +2657,7 @@
     while (urls.count() > mMaxRecentFiles)
       urls.erase( urls.fromLast() );
     while (encodings.count() > mMaxRecentFiles)
-      urls.erase( encodings.fromLast() );
+      encodings.erase( encodings.fromLast() );
     // sanity check
     if (urls.count() != encodings.count()) {
       urls.clear();

Goffredo

P.S.:
I am not in the list, so please cc: me in case of reply. Thanks

--
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack_AT_inwind.it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87  87C0 BB86 505C 6B2A CFF9


[Attachment #5 (application/pgp-signature)]

_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic