D27538: Registry: don't destroy the callback on globalsync

Daniel Vrátil noreply at phabricator.kde.org
Fri Feb 21 09:25:38 GMT 2020


dvratil created this revision.
dvratil added a reviewer: KWin.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
dvratil requested review of this revision.

REVISION SUMMARY
  Instead just unref it, because the wl_display_dispatch_queue_pending
  will try to destroy the callback afterwards as well, leading to
  invalid read/write.
  
  Fixes Valgrind warnings when running KScreen tests:
  
  460922== Invalid read of size 4
  -------------------------------
  
  460922==    at 0x5CE5B34: wl_proxy_unref (wayland-client.c:230)
  ---------------------------------------------------------------
  
  460922==    by 0x5CE5C33: destroy_queued_closure (wayland-client.c:292)
  -----------------------------------------------------------------------
  
  460922==    by 0x5CE74AB: dispatch_queue (wayland-client.c:1591)
  ----------------------------------------------------------------
  
  460922==    by 0x5CE74AB: wl_display_dispatch_queue_pending (wayland-client.c:1833)
  -----------------------------------------------------------------------------------
  
  460922==    by 0x4E0240D: KWayland::Client::EventQueue::dispatch() (src/frameworks/kwayland/src/client/event_queue.cpp:96)
  --------------------------------------------------------------------------------------------------------------------------
  
  g==460922==  Address 0x17233aac is 44 bytes inside a block of size 80 free'd
  
  460922==    at 0x483B9F5: free (vg_replace_malloc.c:540)
  --------------------------------------------------------
  
  460922==    by 0x4E15B60: destroy (src/frameworks/kwayland/src/client/wayland_pointer_p.h:63)
  ---------------------------------------------------------------------------------------------
  
  460922==    by 0x4E15B60: KWayland::Client::Registry::Private::globalSync(void*, wl_callback*, unsigned int) (src/frameworks/kwayland/src/client/registry.cpp:548)
  ------------------------------------------------------------------------------------------------------------------------------------------------------------------
  
  ...
  
  460922==    by 0x5CE74AB: dispatch_queue (wayland-client.c:1591)
  ----------------------------------------------------------------
  
  460922==    by 0x5CE74AB: wl_display_dispatch_queue_pending (wayland-client.c:1833)
  -----------------------------------------------------------------------------------
  
  460922==    by 0x4E0240D: KWayland::Client::EventQueue::dispatch() (src/frameworks/kwayland/src/client/event_queue.cpp:96)
  --------------------------------------------------------------------------------------------------------------------------

TEST PLAN
  Run testkwaylandbackend from libkscreen under Valgrind - no more invalid reads

REPOSITORY
  R127 KWayland

BRANCH
  master

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

AFFECTED FILES
  src/client/registry.cpp

To: dvratil, #kwin
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200221/49de01db/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list