Crash in KRecentFilesAction related to KURL handling

Andras Mantia amantia at
Wed Dec 21 09:54:36 GMT 2005

On Wednesday 21 December 2005 10:44, Andras Mantia wrote:
> On Wednesday 21 December 2005 02:31, Thiago Macieira wrote:
> > I think it is now fixed. David fix it a week ago. I came up with a
> > similar solution today and only found out about David's fix when I
> > tried to commit and got an error of out-of-date sources.
> AFAIK David came up with the continuation of "my workaround" to use a
> copy of the KURL. The problem is this does not help. I have the crash
> with the current kdelibs.

Ok, I found a reason and committed the fix. What happened was:
- when selecting an existing entry, the urlSelected is emitted with a 
url from d->m_urls (d->m_urls[ text ]) (call this emittedURL)
- the connected slot to urlSelected call KRecentFilesAction::addURL, 
where d->m_urls.erase( title ) destroys the very same emittedURL and 
the KURL u = url assignment does not protect us at all. That only 
helped to avoid the crash in addURL itself, but I think the reason was 
the same, so I removed it now.
- if later in the slot emittedURL is used, it will crash.

The solution is to emit a copy in urlSelected, so the internal list of 
urls in d->m_urls can be freely modified and destroyed without hurting 
the application using KRecentFilesAction.

If you know about bug (aside of #118652) caused by this, let me know.

Quanta Plus developer -
K Desktop Environment -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the kde-core-devel mailing list