Patch for Bug 163098
Peter Penz
peter.penz at gmx.at
Fri Aug 22 19:26:44 BST 2008
Hello Frank,
Am Friday, 22. August 2008 02:11:13 schrieb Frank Reininghaus:
> Hi everyone,
>
> I've looked a bit into
> http://bugs.kde.org/show_bug.cgi?id=163098
> (crashes Konqueror and Dolphin if you enable "Automatic" text completion in
> the location bar, enter any 1-character string that prompts a completion
> and hit backspace).
Thanks for having a look on this and providing a patch!
> The problem seems to be in the method KUrlCompletionPrivate::MyURL::init in
> the file kdelibs/kio/kio/kurlcompletion.cpp. The method at() of the QString
> url_copy is called a few times to get the first character of url_copy
> without checking if the string url_copy is empty.
>
> When reproducing this bug, url_copy is indeed empty after hitting
> backspace, and this causes the crash. I'm attaching a patch that fixes the
> problem for me in trunk (note that my patch in comment 9 of the bug report
> only fixes part of it). This just replaces
>
> url_copy.at(0) == QLatin1Char('$') ||
> url_copy.at(0) == QLatin1Char('~') )
>
> by
>
> !url_copy.isEmpty () &&
> ( url_copy.at(0) == QLatin1Char('$') ||
> url_copy.at(0) == QLatin1Char('~') ))
>
> to make sure that the string is not empty before its first character is
> examined.
>
> It's just a suggestion - maybe someone who is more familiar with the code
> can come up with a better idea...
I'm not familiar with the code of KUrlCompletion and hence I'm not sure
whether having an empty url_copy string at this part of the code is a valid
assertion. But from my point of view it is save to commit this patch.
I'd suggest to wait with committing this patch until Tuesday, so that David
Faure has the chance to comment on this too.
Thanks and best regards,
Peter
>
> Cheers
> Frank
More information about the kfm-devel
mailing list