diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-07-17 15:57:41 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-07-18 09:46:29 +0200 |
commit | a2a6a2ddc5f2f9c8e6070acaab0719277872d824 (patch) | |
tree | f0ec20d25c3cb8d9545ff69d241556626100ee29 /vcl | |
parent | 49452f539d18cb525b593d710f5244fcfa810ca0 (diff) |
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@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/qt5/Qt5Widget.hxx | 4 | ||||
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 5 | ||||
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 24 |
3 files changed, 17 insertions, 16 deletions
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: */ |