https://bugs.kde.org/show_bug.cgi?id=405921

Franz Trischberger <franz.trischber...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |---
             Status|RESOLVED                    |REOPENED
     Ever confirmed|0                           |1

--- Comment #6 from Franz Trischberger <franz.trischber...@gmail.com> ---
I finally looked at the source code, and found the issue!
The root lies in the indexing of QList vs. virtual desktops. lists get indexed
starting from 0 while workspaces start from 1 (I am on X11).
The crash also doesn't happen in drag/dropping code but when the pager switches
to the VD you hover with the LMB still pressed (which happens after a certain
timeout).

I have 2 VDs configured.

Then look at this function:
void PagerModel::changePage(int page)
{
    if (currentPage() == page) {
        if (d->showDesktop) {
           
QDBusConnection::sessionBus().asyncCall(QDBusMessage::createMethodCall(QLatin1String("org.kde.plasmashell"),
                QLatin1String("/PlasmaShell"),
                QLatin1String("org.kde.PlasmaShell"),
                QLatin1String("toggleDashboard")));
        }
    } else {
        if (d->pagerType == VirtualDesktops) {
           
d->virtualDesktopInfo->requestActivate(d->virtualDesktopInfo->desktopIds().at(page));
/// here it crashes
        } else {
            const QStringList &runningActivities =
d->activityInfo->runningActivities();
            if (page < runningActivities.length()) {
                KActivities::Controller activitiesController;
               
activitiesController.setCurrentActivity(runningActivities.at(page));
            }
        }
    }
}

That function gets a page and directly hands it down to QVariantList in the
marked line. From the callstack you can see that this function gets called with
page == 2. desktopIds().at(2) is one off the end resulting in an invalid
QVariant object.
I created a quick proof patch:

-
d->virtualDesktopInfo->requestActivate(d->virtualDesktopInfo->desktopIds().at(page));
+
d->virtualDesktopInfo->requestActivate(d->virtualDesktopInfo->desktopIds().at(page-1));

which fixes the crash when moving a task to a different desktop, the task lands
on the selected VD and the pager switches to it. Apperently changing VDs with a
click on the pager is broken with this patch.

I do not know the codebase where all those dragging and clicking events get
handled. But at least now the devs know how/where to fix it.

A quite tricky thing to handle is wayland. Here it looks like indices are
0-based (From the code handling is done with strings). With the patch applied
dragging from VD1 to VD2 now doesn't switch but call showDesktop on VD1 (which
is the active desktop)...

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to