[Libreoffice-commits] core.git: vcl/inc vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Jul 18 07:46:51 UTC 2018
vcl/inc/qt5/Qt5Widget.hxx | 4 +++-
vcl/qt5/Qt5Frame.cxx | 5 ++++-
vcl/qt5/Qt5Widget.cxx | 24 ++++++++++--------------
3 files changed, 17 insertions(+), 16 deletions(-)
New commits:
commit a2a6a2ddc5f2f9c8e6070acaab0719277872d824
Author: Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Tue Jul 17 15:57:41 2018 +0200
Commit: Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Wed Jul 18 09:46:29 2018 +0200
No parent-child relationship between Qt5Widgets
QWidget destructor always deletes all its children, which is fatal
in case not-yet-deleted frame (e.g. because it's in lazy delete queue)
points to one of those children
There's parent-child relationships between the frames though, so perhaps
no need to have it double. For native modality this seems enough
Change-Id: I556ace8d7949bcdfb208170cc08181ac1f2622e8
Reviewed-on: https://gerrit.libreoffice.org/57560
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 32daa2bfef38..efe71bd3f644 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -23,6 +23,8 @@
#include "Qt5Frame.hxx"
-QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f);
+QWidget* createQt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f);
+
+QWidget* createQMainWindow(Qt5Frame& rFrame, Qt::WindowFlags f);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index b47b64ab1cb8..cabee2b2d2dc 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -91,7 +91,10 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
aWinFlags |= Qt::Window;
}
- m_pQWidget.reset(createQt5Widget(*this, pParent ? pParent->GetQWidget() : nullptr, aWinFlags));
+ if (pParent)
+ m_pQWidget.reset(createQt5Widget(*this, aWinFlags));
+ else
+ m_pQWidget.reset(createQMainWindow(*this, aWinFlags));
if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
{
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index c4d38264782c..8f96bc876322 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -452,15 +452,8 @@ template <class ParentClassT> class Qt5Widget : public ParentClassT
virtual void closeEvent(QCloseEvent* event) override { return maMixin.mixinCloseEvent(event); }
private:
- Qt5Widget(Qt5Frame& rFrame, QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags())
- : QWidget(parent, f)
- , maMixin(&rFrame)
- {
- Init();
- }
-
Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)
- : QMainWindow(Q_NULLPTR, f)
+ : ParentClassT(Q_NULLPTR, f)
, maMixin(&rFrame)
{
Init();
@@ -476,15 +469,18 @@ private:
public:
virtual ~Qt5Widget() override{};
- friend QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f);
+ friend QWidget* createQt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f);
+ friend QWidget* createQMainWindow(Qt5Frame& rFrame, Qt::WindowFlags f);
};
-QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f)
+QWidget* createQt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f)
{
- if (parent)
- return new Qt5Widget<QWidget>(rFrame, parent, f);
- else
- return new Qt5Widget<QMainWindow>(rFrame, f);
+ return new Qt5Widget<QWidget>(rFrame, f);
+}
+
+QWidget* createQMainWindow(Qt5Frame& rFrame, Qt::WindowFlags f)
+{
+ return new Qt5Widget<QMainWindow>(rFrame, f);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list