[kstyle] Do not delete the Surface for a QWindow
ClosedPublic

Authored by graesslin on Jul 11 2017, 3:21 PM.

Details

Reviewers
mart
davidedmundson
Group Reviewers
Plasma
Summary

Surface::fromWindow are shared! By deleting the Surface pointer copies in
other areas are getting deleted as well. This breaks e.g. KWin in various
ways.

This fixes a regression introduced with d4940fe692c7be10025bfcb6a118c2cb750039d6

Test Plan

KWin's user action menu can be opened twice again.

Diff Detail

Repository
R31 Breeze
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
graesslin created this revision.Jul 11 2017, 3:21 PM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 11 2017, 3:21 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
graesslin edited the test plan for this revision. (Show Details)Jul 11 2017, 3:26 PM
davidedmundson accepted this revision.Jul 11 2017, 3:33 PM
This revision is now accepted and ready to land.Jul 11 2017, 3:33 PM

Whilst this does make sense based on the current design we are effectively building up dead objects during the lifespan of a window doing show/hide/show.

Someone somewhere should delete it. Assuming everyone follows the same design pattern of following QWindow::hideEvent everyone calling deleteLater() would be safe, but it relies on all parties dealing with surfaces to do that.

Whilst this does make sense based on the current design we are effectively building up dead objects during the lifespan of a window doing show/hide/show.

Well it was designed when Qt didn't behave like that :-(

Someone somewhere should delete it. Assuming everyone follows the same design pattern of following QWindow::hideEvent everyone calling deleteLater() would be safe, but it relies on all parties dealing with surfaces to do that.

No it wouldn't, because KWin doesn't behave like Qt. KWin does not delete a surface when a window gets hidden, but reuses it. Basically KWin behaves exactly as Qt used to, the pattern was taken from QtWayland. Now this diverged.

A possibility could be QSharedPointer, so that every user can discard it's own instance, but that requires also changes all over the place.