Bug 306260 - KWin freezes when navigating between windows
Summary: KWin freezes when navigating between windows
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: tabbox (show other bugs)
Version: 4.9.1
Platform: Compiled Sources Linux
: NOR critical (vote)
Target Milestone: 4.9.2
Assignee: KWin default assignee
URL:
Keywords:
: 306348 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-09-04 18:29 UTC by Andrea Scarpino
Modified: 2012-09-07 13:59 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.2


Attachments
`qdbus org.kde.kwin /KWin supportInformation` output (4.27 KB, text/plain)
2012-09-04 18:31 UTC, Andrea Scarpino
Details
bad settings (103.36 KB, image/png)
2012-09-04 19:16 UTC, Andrea Scarpino
Details
Possible patch (1004 bytes, patch)
2012-09-04 20:26 UTC, Martin Flöser
Details
many windows opened, only the desktop is displayed (270.94 KB, image/png)
2012-09-05 03:59 UTC, Andrea Scarpino
Details
show desktop settings (103.34 KB, image/png)
2012-09-05 04:29 UTC, Andrea Scarpino
Details
New version of patch (2.33 KB, patch)
2012-09-05 16:20 UTC, Martin Flöser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Scarpino 2012-09-04 18:29:34 UTC
I just updated from 4.9.0 to 4.9.1 and KWin often freezes when I use Alt+Tab.

Checking "All other desktops" under the Task Switcher settings let KWin freeze immediately.

Please ask if you need more info.

Reproducible: Always

Steps to Reproduce:
1. KRunner -> task switcher -> check "All other desktops"
2. Try to navigate between windows
Actual Results:  
It freezes

Expected Results:  
Show the next window

KDE 4.9.1 (36e1388afa6e84de6ab1a8e111f5bcf1890b4bbe)
Comment 1 Andrea Scarpino 2012-09-04 18:31:45 UTC
Created attachment 73656 [details]
`qdbus org.kde.kwin /KWin supportInformation` output
Comment 2 Andrea Scarpino 2012-09-04 18:34:48 UTC
More info:
I can reproduce this with both kwin and kwin_gles.

I already wiped ~/.kde4 and /var/tmp/kdecache* but doesn't help.
Comment 3 Andrea Scarpino 2012-09-04 18:35:49 UTC
Reproducible without compositing too.
Comment 4 Andrea Scarpino 2012-09-04 18:43:55 UTC
Just tried with many windows and this only happens when I focus on the Desktop.

To summarize:
Using `current desktop ` I can switch between windows but I can't focus on the Desktop otherwise kwin freezes.
Using `all other desktops` kwin shows only the Desktop in the thumbnails and then it freezes.
Comment 5 Andre Woebbeking 2012-09-04 18:56:10 UTC
I sometimes have the freeze when I'm switching desktops. KWin consumes 100% of the CPU and if I attach GDB the backtrace ends in TabBoxHandlerImpl::nextClientFocusChain() line 101.
Comment 6 Martin Flöser 2012-09-04 19:07:12 UTC
whoops, sorry
Comment 7 Martin Flöser 2012-09-04 19:10:36 UTC
please provide a screenshot of the configuration module with the settings which make it freeze
Comment 8 Andrea Scarpino 2012-09-04 19:16:22 UTC
Created attachment 73657 [details]
bad settings
Comment 9 Martin Flöser 2012-09-04 19:26:16 UTC
in case it happens I assume the list is empty, right?
Comment 10 Andrea Scarpino 2012-09-04 19:27:32 UTC
the list of the tasks? It shows only the Desktop.
Comment 11 Martin Flöser 2012-09-04 19:32:20 UTC
have to get my other system, too many open windows
Comment 12 Martin Flöser 2012-09-04 19:42:06 UTC
ok, was able to trigger the issue, not sure whether I have found a way to reproduce it, but should be fixable.
Comment 13 Andrea Scarpino 2012-09-04 19:45:01 UTC
(In reply to comment #12)
> ok, was able to trigger the issue, not sure whether I have found a way to
> reproduce it, but should be fixable.

Great! Thank you!
I wait news then.
Comment 14 Thomas Lübking 2012-09-04 20:02:45 UTC
It's for pretty much sure in clientmodel.cpp, ::createClientList()

        TabBoxClient* c = start;
        if (!c) {
            QSharedPointer<TabBoxClient> firstClient = tabBox->firstClientFocusChain().toStrongRef();
            if (firstClient) {
                c = firstClient.data();
            }
        }
        TabBoxClient* stop = c;

start will not be in the focus chain, thus stop won't thus there's no stop condition.
Stop has to be the first found nextClientFocusChain()

Sorry, reviewed and didn't see that either :-(
Comment 15 Martin Flöser 2012-09-04 20:26:19 UTC
Created attachment 73658 [details]
Possible patch

please test this patch whether you can somehow still reproduce the freeze. I'm not yet completely sure whether the patch makes the TabBox always behave correctly, will test more tomorrow.
Comment 16 Andrea Scarpino 2012-09-05 03:59:56 UTC
Created attachment 73662 [details]
many windows opened, only the desktop is displayed

Hi,
with this patch the freeze is fixed (which is great), but I can only switch to the Desktop (see the screenshot).
Comment 17 Martin Flöser 2012-09-05 04:23:20 UTC
> but I can only switch to the Desktop (see the screenshot)
given you previous screenshot of the settings dialog that is to be expected, you want to see all windows from other desktops but not from current.
Comment 18 Andrea Scarpino 2012-09-05 04:29:09 UTC
Created attachment 73663 [details]
show desktop settings

Oh rigth, sorry.

Anyway, using these settings, when I've many windows and I focus on the Desktop, the tabbox displays only the Desktop; if I release Alt-Tab, the previous focused windows is displayed.
Comment 19 Martin Flöser 2012-09-05 04:32:10 UTC
could we please keep anything about behavior of tabbox out of this report and concentrate on the freeze?
Comment 20 Andrea Scarpino 2012-09-05 04:34:54 UTC
(In reply to comment #19)
> could we please keep anything about behavior of tabbox out of this report
> and concentrate on the freeze?

Ok, then the freeze is fixed for me.
Comment 21 Martin Flöser 2012-09-05 16:20:16 UTC
Created attachment 73675 [details]
New version of patch

This patch fixes the freeze in a different way so that the regression of bug #306275 does not happen.
Comment 22 Andrea Scarpino 2012-09-05 17:51:33 UTC
(In reply to comment #21)
> Created attachment 73675 [details]
> New version of patch
> 
> This patch fixes the freeze in a different way so that the regression of bug
> #306275 does not happen.

Yes, it does.
Freeze fixed, regression fixed.
Thank you again :)
Comment 23 Martin Flöser 2012-09-05 17:59:07 UTC
the fix is not yet committed - so I better reopen :-)
Comment 24 Martin Flöser 2012-09-05 18:59:25 UTC
Git commit 8452e6c3f01a65953705087e0d7ada87e2cc6997 by Martin Gräßlin.
Committed on 05/09/2012 at 20:55.
Pushed by graesslin into branch 'KDE/4.9'.

Ensure that the start Client to build up the ClientModel is in the Focus Chain

If the start Client is not part of the focus chain the call to
nextClientFocusChain() cannot return the Client again. So the loop break
condition is never reached and as the focus chain is not empty the call
always returns a not null Client which means KWin is caught in an endless
loop.

This change checks that the starting Client is in the focus chain and if
not the first Client of the focus chain is used.
Related: bug 306275
FIXED-IN: 4.9.2

M  +1    -1    kwin/tabbox/clientmodel.cpp
M  +8    -0    kwin/tabbox/tabbox.cpp
M  +1    -0    kwin/tabbox/tabbox.h
M  +14   -0    kwin/tabbox/tabboxhandler.h
M  +17   -0    kwin/tabbox/tests/mock_tabboxhandler.cpp
M  +1    -0    kwin/tabbox/tests/mock_tabboxhandler.h
M  +20   -0    kwin/tabbox/tests/test_tabbox_clientmodel.cpp
M  +7    -0    kwin/tabbox/tests/test_tabbox_clientmodel.h

http://commits.kde.org/kde-workspace/8452e6c3f01a65953705087e0d7ada87e2cc6997
Comment 25 Andre Woebbeking 2012-09-06 07:37:32 UTC
On Wednesday 05 September 2012 18:59:25 Martin Gräßlin wrote:
> https://bugs.kde.org/show_bug.cgi?id=306260
> 
> Martin Gräßlin <mgraesslin@kde.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
> Status|REOPENED                    |RESOLVED
>    Version Fixed In|                            |4.9.2
>          Resolution|---                         |FIXED

Thank you for the fast fix!
Comment 26 Thomas Lübking 2012-09-07 13:59:03 UTC
*** Bug 306348 has been marked as a duplicate of this bug. ***