D22986: RFC: fix: Prevent heap-use-after-free when tearing down

Vlad Zagorodniy <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
zzag created this revision.
zzag added a reviewer: KWin.
Herald added a project: KWin.
Herald added a subscriber: kwin.
zzag requested review of this revision.

REVISION SUMMARY
  Managing lifetime of objects during tear down is a bit clunky in KWin
  mostly because the wayland server outlives the workspace.
  
  3f4e7334684 <https://phabricator.kde.org/R108:3f4e73346845092a4fc555f03888c2398c299e0f> tried to tackle one aspect of this problem, but the proposed
  solution is good only in short term. If a ShellClient wants to discard
  force temporarily rules, it needs to access RuleBook, whose lifetime is
  bounded to the workspace, no matter what happens. Otherwise, the force
  temporarily rule will be applied again on the next startup.
  
  It's worth to mention that there was another attempt to address this
  problem, see commit 826b9742e95 <https://phabricator.kde.org/R108:826b9742e95069f1a15df5c1ccf4f17083be2726>. It was reverted because some internal
  clients may need to destroy Wayland resources during tear down.
  
  This change takes another approach. In order to ensure that ShellClient
  can access RuleBook during tear down, we manually destroy Wayland clients
  in destructor of the Workspace class. Something is done already for X11
  clients.

REPOSITORY
  R108 KWin

BRANCH
  another-patch-to-fix-heap-use-after-free

REVISION DETAIL
  https://phabricator.kde.org/D22986

AFFECTED FILES
  shell_client.cpp
  shell_client.h
  workspace.cpp

To: zzag, #kwin
Cc: kwin, LeGast00n, sbergeron, jraleigh, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, Pitel, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.