effect: Prevent QJSEngine garbage collecting EffectWindow

EffectWindow has no parent so QJSEngine can garbage collect an instance
if it's returned by a function marked with Q_INVOKABLE.

CCBUG: 487771


(cherry picked from commit 8a5a9f7c12)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
wilder/Plasma/6.2
Vlad Zahorodnii 1 year ago
parent 97239ef061
commit 1ff218667c
  1. 4
      src/effect/effectwindow.cpp

@ -20,6 +20,8 @@
#include "x11window.h"
#endif
#include <QJSEngine>
namespace KWin
{
@ -47,6 +49,8 @@ EffectWindow::Private::Private(EffectWindow *q, WindowItem *windowItem)
EffectWindow::EffectWindow(WindowItem *windowItem)
: d(new Private(this, windowItem))
{
QJSEngine::setObjectOwnership(this, QJSEngine::CppOwnership);
// Deleted windows are not managed. So, when windowClosed signal is
// emitted, effects can't distinguish managed windows from unmanaged
// windows(e.g. combo box popups, popup menus, etc). Save value of the

Loading…
Cancel
Save