wayland: Fix buffer ref'ing in org_kde_kwin_shadow.commit

In case the current state and the pending state have the same buffer for
a particular side or a corner, that buffer can be prematurely released
because the buffer in the current state is unreferenced first.

The ref/unref order should be vice versa to ensure that the GraphicsBuffer
is not released prematurely.
wilder/Plasma/6.2
Vlad Zahorodnii 2 years ago
parent ba599a2aa0
commit 1a7c94b692
  1. 6
      src/wayland/shadow.cpp

@ -139,12 +139,12 @@ void ShadowInterfacePrivate::org_kde_kwin_shadow_commit(Resource *resource)
{
#define BUFFER(__FLAG__, __PART__) \
if (pending.flags & State::Flags::__FLAG__##Buffer) { \
if (current.__PART__) { \
current.__PART__->unref(); \
} \
if (pending.__PART__) { \
pending.__PART__->ref(); \
} \
if (current.__PART__) { \
current.__PART__->unref(); \
} \
current.__PART__ = pending.__PART__; \
}
BUFFER(Left, left)

Loading…
Cancel
Save