<table><tr><td style="">graesslin created this revision.<br />graesslin added reviewers: KWin, Plasma.<br />Restricted Application added a project: KWin.<br />Restricted Application added subscribers: kwin, plasma-devel.<br />graesslin requested review of this revision.<br />Restricted Application edited projects, added Plasma; removed KWin.
</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/D10549" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>If the cursor theme failed to create KWin crashed due to an endless<br />
recursion. There are two reasons for this fault:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">When the physical size does not exist we perform a division by 0</li>
</ol>
<p>which results in an invalid size going into wl_cursor_theme_load</p>
<ol class="remarkup-list" start="2">
<li class="remarkup-list-item">We emit the signal that the cursor theme changed even if it didn't</li>
</ol>
<p>change thus creating an endless recursion</p>
<p>This change addresses both problems: it checks that the size is not 0<br />
and changes the handling for theme update to only destroy the previous<br />
theme if the new theme could be created and only emits the signal if<br />
things change.</p>
<p>BUG: 390314<br />
FIXED-IN: 5.12.2</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Added a new test case which crashed with old code</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>dont-crash-cursor-theme-failure</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10549" rel="noreferrer">https://phabricator.kde.org/D10549</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/integration/CMakeLists.txt<br />
autotests/integration/dont_crash_cursor_physical_size_empty.cpp<br />
wayland_cursor_theme.cpp</div></div></div><br /><div><strong>To: </strong>graesslin, KWin, Plasma<br /><strong>Cc: </strong>plasma-devel, kwin, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>