aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp9
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h1
-rw-r--r--tests/auto/controls/data/tst_textarea.qml16
3 files changed, 25 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index 4a171603..afc2932c 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -256,7 +256,7 @@ void QQuickTextAreaPrivate::detachFlickable()
QObject::disconnect(flickable, &QQuickFlickable::contentXChanged, q, &QQuickItem::update);
QObject::disconnect(flickable, &QQuickFlickable::contentYChanged, q, &QQuickItem::update);
- QQuickItemPrivate::get(flickable)->updateOrRemoveGeometryChangeListener(this, QQuickGeometryChange::Size);
+ QQuickItemPrivate::get(flickable)->updateOrRemoveGeometryChangeListener(this, QQuickGeometryChange::Nothing);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
@@ -406,6 +406,13 @@ QQuickTextArea::QQuickTextArea(QQuickItem *parent)
d, &QQuickTextAreaPrivate::readOnlyChanged);
}
+QQuickTextArea::~QQuickTextArea()
+{
+ Q_D(QQuickTextArea);
+ if (d->flickable)
+ d->detachFlickable();
+}
+
QQuickTextAreaAttached *QQuickTextArea::qmlAttachedProperties(QObject *object)
{
return new QQuickTextAreaAttached(object);
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
index af7c1d13..87cb57bc 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -72,6 +72,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextArea : public QQuickTextEdit
public:
explicit QQuickTextArea(QQuickItem *parent = nullptr);
+ ~QQuickTextArea();
static QQuickTextAreaAttached *qmlAttachedProperties(QObject *object);
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 0b68edc9..7c47aa25 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -449,4 +449,20 @@ TestCase {
mouseClick(control, rect.x + rect.width / 2, rect.y + rect.height / 2)
compare(control.selectedText, "Qt Quick Controls 2 TextArea")
}
+
+ Component {
+ id: scrollView
+ ScrollView {
+ TextArea { }
+ }
+ }
+
+ function test_scrollView() {
+ var control = createTemporaryObject(scrollView, testCase)
+ verify(control)
+
+ // don't crash (QTBUG-62292)
+ control.destroy()
+ wait(0)
+ }
}