[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - vcl/inc vcl/qt5
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 21 14:11:44 UTC 2019
vcl/inc/qt5/Qt5Object.hxx | 3 +--
vcl/qt5/Qt5Object.cxx | 10 ++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
New commits:
commit 86eb298506464a6138015168c00253096e3c6d05
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Jun 21 01:49:59 2019 +0000
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Jun 21 16:10:38 2019 +0200
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 at basealt.ru>
(cherry picked from commit f0c9b93e5bc7976dea5de4a49be87cc9892941a7)
Reviewed-on: https://gerrit.libreoffice.org/74496
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
diff --git a/vcl/inc/qt5/Qt5Object.hxx b/vcl/inc/qt5/Qt5Object.hxx
index 6bfdd81b0327..c6dce6e944be 100644
--- a/vcl/inc/qt5/Qt5Object.hxx
+++ b/vcl/inc/qt5/Qt5Object.hxx
@@ -33,8 +33,6 @@ class Qt5Object : public QObject, public SalObject
{
Q_OBJECT
- friend class Qt5OpenGLContext;
-
SystemEnvData m_aSystemData;
Qt5Frame* m_pParent;
QWidget* m_pQWidget; // main widget, container
@@ -43,6 +41,7 @@ class Qt5Object : public QObject, public SalObject
public:
Qt5Object(Qt5Frame* pParent, bool bShow);
+ ~Qt5Object() override;
Qt5Frame* frame() const { return m_pParent; }
QWidget* widget() const { return m_pQWidget; }
diff --git a/vcl/qt5/Qt5Object.cxx b/vcl/qt5/Qt5Object.cxx
index cf0bd05b89cf..a0afe811a40c 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)
More information about the Libreoffice-commits
mailing list