aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2021-05-21 14:17:03 +0200
committerAndy Shaw <andy.shaw@qt.io>2021-05-26 09:00:56 +0200
commit4cba29c38cb1b610bf896130050b6c14b7e10c71 (patch)
tree69a087794e3cedda2c05cbfacafce12720c29398 /src/quicktemplates2
parent40ee2118802f777b48262e71086b2a7c930d140a (diff)
TextArea: Detach the flickable when it is deleted
When the flickable is deleted before the TextArea is (which can happen when it is a child of a ScrollView) then we need to make sure that the TextArea no longer keeps a reference to the Flickable object. Fixes: QTBUG-93958 Pick-to: 6.1 5.15 Change-Id: I1745065370718e60bc459192e15eae0e1ba36231 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index bcc08c05..183c929e 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -318,6 +318,7 @@ void QQuickTextAreaPrivate::attachFlickable(QQuickFlickable *item)
QObject::connect(flickable, &QQuickFlickable::contentYChanged, q, &QQuickItem::update);
QQuickItemPrivate::get(flickable)->updateOrAddGeometryChangeListener(this, QQuickGeometryChange::Size);
+ QQuickItemPrivate::get(flickable)->addItemChangeListener(this, QQuickItemPrivate::Destroyed);
QObjectPrivate::connect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
QObjectPrivate::connect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
@@ -338,6 +339,7 @@ void QQuickTextAreaPrivate::detachFlickable()
QObject::disconnect(flickable, &QQuickFlickable::contentYChanged, q, &QQuickItem::update);
QQuickItemPrivate::get(flickable)->updateOrRemoveGeometryChangeListener(this, QQuickGeometryChange::Nothing);
+ QQuickItemPrivate::get(flickable)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
@@ -522,6 +524,8 @@ void QQuickTextAreaPrivate::itemDestroyed(QQuickItem *item)
background = nullptr;
emit q->implicitBackgroundWidthChanged();
emit q->implicitBackgroundHeightChanged();
+ } else if (item == flickable) {
+ detachFlickable();
}
}