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

List:       kmail-devel
Subject:    Re: [PATCH][TRIVIAL] Crash during a "insert file" in the composer
From:       Don Sanders <sanders () kde ! org>
Date:       2006-01-09 8:32:01
Message-ID: 200601091832.03285.sanders () kde ! org
[Download RAW message or body]

On Sunday 08 January 2006 04:13, Goffredo Baroncelli wrote:
> 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.

I've been meaning to look into these bugs but haven't been able to 
find the time. Thanks very much for looking into the issue.

> 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'.

Yes you are correct, that is embarrassing. Thanks very much for 
detecting this.

> 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

This is excellent, the change looks fine. Thanks ever so much. Do you 
have commit privs? Can you commit?

If not I'll commit the patch to HEAD and to the KDE_3_5_BRANCH (or 
whatever it is called, assuming no one beats me to it).

Thanks again,
Don Sanders.
_______________________________________________
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