graesslin created this revision. graesslin added reviewers: KWin, Plasma. Restricted Application added a project: KWin. Restricted Application added subscribers: kwin, plasma-devel. graesslin requested review of this revision. Restricted Application edited projects, added Plasma; removed KWin.
REVISION SUMMARY It was possible that the update method was called recursively. This could result in unpredicted behavior and in the worst case a crash. This was exposed by adding tooltips to the window decoration (master). There we have the following sequence: 1. pointer above an internal window (m_internalWindow is not null) 2. updateDecoration is called 3. triggers a hover enter on a decoration button 4. this creates a Tooltip 5. which means a new internal window is added 6. update is called again 7. m_internalWindow gets reset 8. back to previous update, now m_internalWindow is null although the if before evaluated to not null -> crash To prevent this a recursion blocker RAII class is introduced which calls update again if the method got entered a second time. Thus the update method can finish operation without the assumptions being changed while executed. The changes which are required due to the second call will be applied once we leave the method. Targeting 5.12 as this is a general problem, although the bug is only in master. BUG: 389350 FIXED-IN: 5.12.1 TEST PLAN No more crash when hovering close button on DebugConsole REPOSITORY R108 KWin BRANCH input-update-blocker-5.12 REVISION DETAIL https://phabricator.kde.org/D10291 AFFECTED FILES pointer_input.cpp touch_input.cpp update_recursion_blocker.h To: graesslin, #kwin, #plasma Cc: plasma-devel, kwin, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart