From 79238b06cf51779dc5bee690026a31a7f6c3c109 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 24 May 2024 15:31:43 +0300 Subject: [PATCH] core: Check that GraphicsBuffer references change on the main thread --- src/core/graphicsbuffer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/graphicsbuffer.cpp b/src/core/graphicsbuffer.cpp index e83fcd7bf8..8be517be71 100644 --- a/src/core/graphicsbuffer.cpp +++ b/src/core/graphicsbuffer.cpp @@ -7,6 +7,8 @@ #include "core/graphicsbuffer.h" #include "utils/drm_format_helper.h" +#include + #include namespace KWin @@ -29,11 +31,13 @@ bool GraphicsBuffer::isDropped() const void GraphicsBuffer::ref() { + Q_ASSERT(QCoreApplication::instance()->thread() == thread()); ++m_refCount; } void GraphicsBuffer::unref() { + Q_ASSERT(QCoreApplication::instance()->thread() == thread()); Q_ASSERT(m_refCount > 0); --m_refCount; if (!m_refCount) {