[wayland] Don't crash when resizing windows
ClosedPublic

Authored by zzag on Nov 12 2018, 6:17 PM.

Details

Summary

If you resize a decorated client by using the resize user action(press
Alt + F3 > More Actions > Resize), then KWin will crash because it gets
stuck in an infinite loop (AbstractClient::performMoveResize <->
ShellClient::setGeometry).

Here's how KWin gets stuck in that loop:

  • when you finish resizing the client, AbstractClient::keyPressEvent will call AbstractClient::finishMoveResize;
  • the first thing that finishMoveResize does is block geometry updates, then it does some clean up (e.g. reset the value of isMoveResize(), etc), updates the geometry of the client and when it's done, it will emit clientFinishUserMoveResized signal;
  • when PointerInputRedirection notices that signal, it will call processDecorationMove on the client, which in its turn will indirectly call AbstractClient::startMoveResize;
  • when it's time to go back to AbstractClient::keyPressEvent, geometry updates are unblocked and if there are any pending geometry updates, then ShellClient::setGeometry will be called;
  • ShellClient::setGeometry will eventually call ShellClient::doSetGeometry;
  • ShellClient::doSetGeometry will call AbstractClient::performMoveResize because AbstractClient::processDecorationMove indirectly called AbstractClient::startMoveResize;
  • AbstractClient::performMoveResize calls ShellClient::setGeometry;
  • (at this point, KWin got stuck in the infinite loop)

This change swaps setMoveResizePointerButtonDown and finishMoveResize,
so processDecorationMove won't indirectly call startMoveResize.

BUG: 397577
FIXED-IN: 5.14.4

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Nov 12 2018, 6:17 PM
Restricted Application added a project: KWin. · View Herald TranscriptNov 12 2018, 6:17 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Nov 12 2018, 6:17 PM
zzag edited the summary of this revision. (Show Details)Nov 12 2018, 6:34 PM
davidedmundson accepted this revision.Nov 12 2018, 11:56 PM
This revision is now accepted and ready to land.Nov 12 2018, 11:56 PM
This revision was automatically updated to reflect the committed changes.