D10291: Add a recursion blocker in Pointer/TouchInputRedirection::update

Martin Flöser noreply at phabricator.kde.org
Sun Feb 4 12:39:34 UTC 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180204/ad5db5bd/attachment.html>


More information about the Plasma-devel mailing list