Delay syncing internal window geometry to end of cycle

Authored by graesslin on Sep 6 2017, 7:03 PM.



The syncing of the window geometry to the internal geometry can
unfortunately cause a freeze in very special conditions:

  1. create QML component
  2. a Plasma::Dialog gets created
  3. It creates the DialogShadows
  4. This triggers QGlobalStatic creation which locks a non-recursive


  1. The creation of DialogShadows creates a Registry and triggers a

roundtrip on the Wayland server

  1. KWin processes all Wayland events
  2. This triggers the creation of a ShellClient
  3. The ShellClient has a PlasmaShellSurface which requested a position
  4. The new geometry does not match the geometry of the Plasma::Dialog
  5. ShellClient syncs the geometry to the Plasma::Dialog
  6. Plasma::Dialog updates the theme because window geometry changed
  7. This accesses the DialogShadows...

which is still in the non recursive mutex and we have a freeze.

By delaying the sync to the end of cycle we jump out of this deadly

BUG: 384441

Test Plan

The freeze doesn't hit any more. It's possible that some test
cases need adjustments.

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Sep 6 2017, 7:03 PM
Restricted Application added a project: KWin. · View Herald TranscriptSep 6 2017, 7:03 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
davidedmundson accepted this revision.Sep 6 2017, 8:04 PM
davidedmundson added a subscriber: davidedmundson.

I don't really like it, there's quite a few other things that edit internal windows whilst they're doing a roundtrip, which puts us in a somewhat weird state.

...but I don't think any alternative approaches are any better either.

This revision is now accepted and ready to land.Sep 6 2017, 8:04 PM
This revision was automatically updated to reflect the committed changes.