Use itemChange instead of a connect to windowChanged

with itemChange watching SceneChange is more efficient than connecting
to the windowChanged signal, also this won't arrive during teardown,
aoiding the "destructor already ran" assert.
master
Marco Martin 11 months ago
parent c0cc162ba6
commit e67847d43f

@ -106,8 +106,6 @@ WindowThumbnailItem::WindowThumbnailItem(QQuickItem *parent)
this, &WindowThumbnailItem::destroyOffscreenTexture);
connect(Compositor::self(), &Compositor::compositingToggled,
this, &WindowThumbnailItem::updateFrameRenderingConnection);
connect(this, &QQuickItem::windowChanged,
this, &WindowThumbnailItem::updateFrameRenderingConnection);
}
WindowThumbnailItem::~WindowThumbnailItem()
@ -133,6 +131,14 @@ void WindowThumbnailItem::releaseResources()
}
}
void WindowThumbnailItem::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
{
if (change == QQuickItem::ItemSceneChange) {
updateFrameRenderingConnection();
}
QQuickItem::itemChange(change, value);
}
bool WindowThumbnailItem::isTextureProvider() const
{
return true;

@ -45,6 +45,7 @@ public:
protected:
void releaseResources() override;
void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override;
Q_SIGNALS:
void wIdChanged();

Loading…
Cancel
Save