Bug 294005

Summary: Infinite loop in KSelectionProxyModel's _getRootListRow()
Product: [Unmaintained] kdelibs Reporter: Christopher Yeleighton <giecrilj>
Component: kdeuiAssignee: Stephen Kelly <steveire>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: faure, mollekopf, sreich, steveire
Priority: NOR    
Version: Git   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: http://projects.kde.org/projects/kde/kdelibs/repository/revisions/master/entry/kdeui/itemviews/kselectionproxymodel.cpp#L185
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Christopher Yeleighton 2012-02-13 17:04:30 UTC
while (nextParent == commonParent) {
        if (ansList.size() < bestParentRow + 1)
            // If the list is longer, it means that at the end of it is a descendant of the new index.
            // We insert the ancestors items first in that case.
            break;

        const QModelIndex nextSibling = ansList.value(bestParentRow + 1);

        if (!nextSibling.isValid()) {
            continue;
        }

I ran into this when I added a fourth mail repository to KMail.  The code loops from line 185 to line 194; nothing in between affects the condition of line 185.  In effect, KMail hangs on startup and I am unable to access its preferences.
Comment 1 Christopher Yeleighton 2012-02-13 17:31:49 UTC
The backtrace is in Bug 289476
Comment 2 Christian Mollekopf 2014-03-18 10:04:48 UTC
If nextSibling is ever invalid, this indeed results in an endless loop. I'm not sure how to fix it though.
Comment 3 Christoph Cullmann 2024-09-14 17:06:51 UTC
Hi,

kdelibs (version 4 and earlier) is no longer maintained since a few years.

KDE Frameworks 5 or 6 might already have resolved this bug.

If not, please re-open against the matching framework if feasible or against the application that shows the issue.

We then can still dispatch it to the right Bugzilla product or component.

Greetings
Christoph Cullmann