[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Patch for Bug 163098
From: Frank Reininghaus <frank78ac () googlemail ! com>
Date: 2008-08-22 0:11:13
Message-ID: 200808220211.13415.frank78ac () googlemail ! com
[Download RAW message or body]
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
["patch-bug-163098" (text/x-diff)]
Index: kio/kio/kurlcompletion.cpp
===================================================================
--- kio/kio/kurlcompletion.cpp (revision 850057)
+++ kio/kio/kurlcompletion.cpp (working copy)
@@ -484,8 +484,9 @@
{
m_kurl = new KUrl;
if ( !QDir::isRelativePath(url_copy) ||
- url_copy.at(0) == QLatin1Char('$') ||
- url_copy.at(0) == QLatin1Char('~') )
+ !url_copy.isEmpty () &&
+ ( url_copy.at(0) == QLatin1Char('$') ||
+ url_copy.at(0) == QLatin1Char('~') ))
m_kurl->setPath( url_copy );
else
*m_kurl = url_copy;
@@ -496,8 +497,9 @@
base.adjustPath(KUrl::AddTrailingSlash);
if ( !QDir::isRelativePath(url_copy) ||
- url_copy.at(0) == QLatin1Char('~') ||
- url_copy.at(0) == QLatin1Char('$') )
+ !url_copy.isEmpty () &&
+ ( url_copy.at(0) == QLatin1Char('~') ||
+ url_copy.at(0) == QLatin1Char('$') ))
{
m_kurl = new KUrl;
m_kurl->setPath( url_copy );
@@ -618,7 +620,7 @@
{
//kDebug() << text << "d->cwd=" << d->cwd;
- KUrlCompletionPrivate::MyURL url(text, d->cwd);
+ KUrlCompletionPrivate::MyURL url(text, d->cwd);
d->compl_text = text;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic