<table><tr><td style="">graesslin created this revision.<br />Restricted Application added a project: KWin.<br />Restricted Application added subscribers: kwin, plasma-devel.
</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/D7712" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>The syncing of the window geometry to the internal geometry can<br />
unfortunately cause a freeze in very special conditions:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">create QML component</li>
<li class="remarkup-list-item">a Plasma::Dialog gets created</li>
<li class="remarkup-list-item">It creates the DialogShadows</li>
<li class="remarkup-list-item">This triggers QGlobalStatic creation which locks a non-recursive</li>
</ol>
<p>mutex</p>
<ol class="remarkup-list" start="5">
<li class="remarkup-list-item">The creation of DialogShadows creates a Registry and triggers a</li>
</ol>
<p>roundtrip on the Wayland server</p>
<ol class="remarkup-list" start="6">
<li class="remarkup-list-item">KWin processes all Wayland events</li>
<li class="remarkup-list-item">This triggers the creation of a ShellClient</li>
<li class="remarkup-list-item">The ShellClient has a PlasmaShellSurface which requested a position</li>
<li class="remarkup-list-item">The new geometry does not match the geometry of the Plasma::Dialog</li>
<li class="remarkup-list-item">ShellClient syncs the geometry to the Plasma::Dialog</li>
<li class="remarkup-list-item">Plasma::Dialog updates the theme because window geometry changed</li>
<li class="remarkup-list-item">This accesses the DialogShadows...</li>
</ol>
<p>which is still in the non recursive mutex and we have a freeze.</p>
<p>By delaying the sync to the end of cycle we jump out of this deadly<br />
sequence.</p>
<p>BUG: 384441</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>The freeze doesn't hit any more. It's possible that some test<br />
cases need adjustments.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>delay-internal-geometry-sync</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7712" rel="noreferrer">https://phabricator.kde.org/D7712</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>shell_client.cpp</div></div></div><br /><div><strong>To: </strong>graesslin, KWin, Plasma<br /><strong>Cc: </strong>plasma-devel, kwin, bwowk, ZrenBot, progwolff, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart<br /></div>