Patch for Bug 163098
Frank Reininghaus
frank78ac at googlemail.com
Fri Aug 22 01:11:13 BST 2008
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).
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...
Cheers
Frank
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-bug-163098
Type: text/x-diff
Size: 1165 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20080822/2ec68628/attachment.diff>
More information about the kfm-devel
mailing list