[Differential] [Request, 54 lines] D1937: [server] Unset SurfaceInterface pointer in referenced objects when being destroyed

graesslin (Martin Gräßlin) noreply at phabricator.kde.org
Fri Jun 17 13:40:01 UTC 2016


graesslin created this revision.
graesslin added a reviewer: Plasma on Wayland.
Restricted Application added a subscriber: plasma-devel.
Restricted Application added a project: Plasma on Wayland.

REVISION SUMMARY
  This is a gotcha moment:
  
  1. Create Surface with id 1
  2. destroy that Surface
  3. Create another Surface
  
  Now if in step 3 the id is by pure chance getting reused and also 1, the
  wl_resource pointer of the SurfaceInterface of step 1 and step 3 are
  the same. This is rather unexpected and causes problems.
  
  When creating a ShellSurface in step 1 and step 3 it would fail. KWayland
  finds a ShellSurface which was already created for the Surface. The same
  can happen with QtSurfaceExtensionInterface and PlasmaShellInterface which
  also go into error state.
  
  On client side this would trigger a protocol error and terminate the
  application. An easy way to reproduce is opening the file open dialog
  from within Kate multiple times.
  
  This change addresses this problem by setting the surface pointer in
  those classes to null when the parent Surface gets destroyed. Thus
  creating a new ShellSurface won't find the old referenced Surface any
  more.
  
  For ShellSurface a test case is added which hit the condition without
  this change. For the other two cases it's difficult to hit with a test
  case. For QtSurfaceExtension we don't have the client side, for
  PlasmaShellSurface we have proper cleanup, so it's much more unlikely
  to hit the condition.

REPOSITORY
  rKWAYLAND KWayland

BRANCH
  unset-surface

REVISION DETAIL
  https://phabricator.kde.org/D1937

AFFECTED FILES
  autotests/client/test_wayland_shell.cpp
  src/server/plasmashell_interface.cpp
  src/server/qtsurfaceextension_interface.cpp
  src/server/shell_interface.cpp

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: graesslin, #plasma_on_wayland
Cc: plasma-devel, jensreuterberg, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160617/b2f31cfd/attachment.html>


More information about the Plasma-devel mailing list