summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2019-06-21 01:49:59 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2019-06-21 12:43:13 +0200
commitf0c9b93e5bc7976dea5de4a49be87cc9892941a7 (patch)
tree2e8e759726c60450e8951fdaed0331faa183adc0 /vcl/qt5
parentf270bd15fed87a9cb0f8dfa73b34c617d66f59c2 (diff)
tdf#126020 Qt5 delete orphan Qt5ObjectWindows
The Qt5ObjectWindow is "adopted" by Qt5Frame's QWidget, which is needed for the correct display. But since the Qt5Object is itself a child of the Qt5Frame, it'll be deleted before the Qt5Frame, which keeps the Qt5ObjectWindows alive. But the Qt5ObjectWindows child relies on the Qt5Object parent, so reap it, when the real parent is destructed. And just in case the Qt5Frame will delete the QWidget with the child while the Qt5Object is still alive, update the pointer to the child on its destruction. Change-Id: I563ddc2294b7b1651f56abdde75319c7455dd9b7 Reviewed-on: https://gerrit.libreoffice.org/74482 Tested-by: Jenkins Reviewed-by: Aleksei Nikiforov <darktemplar@basealt.ru>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/Qt5Object.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/qt5/Qt5Object.cxx b/vcl/qt5/Qt5Object.cxx
index 6c5238f012dc..961622eeb893 100644
--- a/vcl/qt5/Qt5Object.cxx
+++ b/vcl/qt5/Qt5Object.cxx
@@ -36,6 +36,7 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow)
m_pQWindow = new Qt5ObjectWindow(*this);
m_pQWidget = QWidget::createWindowContainer(m_pQWindow, pParent->GetQWidget());
m_pQWidget->setAttribute(Qt::WA_NoSystemBackground);
+ connect(m_pQWidget, &QObject::destroyed, this, [this]() { m_pQWidget = nullptr; });
if (bShow)
m_pQWidget->show();
@@ -65,6 +66,15 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow)
}
}
+Qt5Object::~Qt5Object()
+{
+ if (m_pQWidget)
+ {
+ m_pQWidget->setParent(nullptr);
+ delete m_pQWidget;
+ }
+}
+
void Qt5Object::ResetClipRegion()
{
if (m_pQWidget)