<table><tr><td style="">zzag created this revision.<br />zzag added a reviewer: KWin.<br />Herald added a project: KWin.<br />Herald added a subscriber: kwin.<br />zzag requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D22986">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Managing lifetime of objects during tear down is a bit clunky in KWin<br />
mostly because the wayland server outlives the workspace.</p>
<p><a href="https://phabricator.kde.org/R108:3f4e73346845092a4fc555f03888c2398c299e0f" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">3f4e7334684</a> tried to tackle one aspect of this problem, but the proposed<br />
solution is good only in short term. If a ShellClient wants to discard<br />
force temporarily rules, it needs to access RuleBook, whose lifetime is<br />
bounded to the workspace, no matter what happens. Otherwise, the force<br />
temporarily rule will be applied again on the next startup.</p>
<p>It's worth to mention that there was another attempt to address this<br />
problem, see commit <a href="https://phabricator.kde.org/R108:826b9742e95069f1a15df5c1ccf4f17083be2726" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">826b9742e95</a>. It was reverted because some internal<br />
clients may need to destroy Wayland resources during tear down.</p>
<p>This change takes another approach. In order to ensure that ShellClient<br />
can access RuleBook during tear down, we manually destroy Wayland clients<br />
in destructor of the Workspace class. Something is done already for X11<br />
clients.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>another-patch-to-fix-heap-use-after-free</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D22986">https://phabricator.kde.org/D22986</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>shell_client.cpp<br />
shell_client.h<br />
workspace.cpp</div></div></div><br /><div><strong>To: </strong>zzag, KWin<br /><strong>Cc: </strong>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<br /></div>