[kde-baseapps] dolphin/src/kitemviews: Fix crash when browsing bluetooth device.

Frank Reininghaus frank78ac at googlemail.com
Thu Jan 3 08:37:41 GMT 2013


Hi Michael,

2012/12/30 Michael Jansen <kde at michael-jansen.biz>:
> Git commit f0c90a47de3f59e4a98932ae6f0499921d9aa899 by Michael Jansen.
> Committed on 30/12/2012 at 20:56.
> Pushed by mjansen into branch 'master'.
>
> Fix crash when browsing bluetooth device.
>
> When trying to browse a N900 it crashed here because pathA was empty. Which
> lead to index = maxIndex beeing -1 and pathA.at(index) crashing.
>
> Reorder the while condition to prevent that courtesy of tsdgeos.
>
> M  +1    -1    dolphin/src/kitemviews/kfileitemmodel.cpp
>
> http://commits.kde.org/kde-baseapps/f0c90a47de3f59e4a98932ae6f0499921d9aa899
>
> diff --git a/dolphin/src/kitemviews/kfileitemmodel.cpp b/dolphin/src/kitemviews/kfileitemmodel.cpp
> index 231bfe0..6c015db 100644
> --- a/dolphin/src/kitemviews/kfileitemmodel.cpp
> +++ b/dolphin/src/kitemviews/kfileitemmodel.cpp
> @@ -1499,7 +1499,7 @@ int KFileItemModel::expandedParentsCountCompare(const ItemData* a, const ItemDat
>      if (index > maxIndex) {
>          index = maxIndex;
>      }
> -    while ((pathA.at(index) != QLatin1Char('/') || pathB.at(index) != QLatin1Char('/')) && index > 0) {
> +    while (index > 0 && (pathA.at(index) != QLatin1Char('/') || pathB.at(index) != QLatin1Char('/'))) {
>          --index;
>      }
>

first of all, thanks for the fix. Even though the change is obviously
good, discussing it here before the commit would have enabled me to
ask the following question before the push, rather than now:

Why push to master only? Safe crash fixes such as this one should
definitely be pushed to KDE/4.10 as well.

Best regards,
Frank




More information about the kfm-devel mailing list