[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - 2 commits - sw/source vcl/unx

Katarina Behrens Katarina.Behrens at cib.de
Tue Feb 27 10:38:46 UTC 2018


 sw/source/uibase/uiview/view1.cxx     |   27 +++++++++++++++++++++++++++
 vcl/unx/gtk3_kde5/kde5_filepicker.cxx |   13 +++++++------
 vcl/unx/gtk3_kde5/kde5_filepicker.hxx |    4 ++--
 3 files changed, 36 insertions(+), 8 deletions(-)

New commits:
commit 8143f1c4d114d5a1f16851f5421c45afe6537575
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Fri Feb 23 16:13:02 2018 +0100

    Make shell stack more robust against rogue extensions
    
    It shouldn't happen that a view is placed above the shells
    it has spawned on sfx2 dispatcher's shell stack 'cause
    during dispose, such view gets deleted before the shells
    that still refer to it.
    
    Alas it does happen with Wollmux (which makes couple of
    Writer UNO API calls before SwView is activated) so guard
    against that
    
    Change-Id: Ic7f21992c5e55a48c63dffc733c8f5b0a59a9126
    Reviewed-on: https://gerrit.libreoffice.org/50256
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit b7e3e73b8015e20f8303ea1f2a2156128ae411e2)

diff --git a/sw/source/uibase/uiview/view1.cxx b/sw/source/uibase/uiview/view1.cxx
index 6957fb5b484e..d9eeb58c6e99 100644
--- a/sw/source/uibase/uiview/view1.cxx
+++ b/sw/source/uibase/uiview/view1.cxx
@@ -23,6 +23,7 @@
 #include <svx/sidebar/ContextChangeEventMultiplexer.hxx>
 #include <idxmrk.hxx>
 #include <view.hxx>
+#include <basesh.hxx>
 #include <wrtsh.hxx>
 #include <swmodule.hxx>
 #include <viewopt.hxx>
@@ -71,6 +72,32 @@ void SwView::Activate(bool bMDIActivate)
 
     if ( bMDIActivate )
     {
+        if ( m_pShell )
+        {
+            SfxDispatcher &rDispatcher = GetDispatcher();
+            SfxShell *pTopShell = rDispatcher.GetShell( 0 );
+
+            // this SwView is the top-most shell on the stack
+            if ( pTopShell == this )
+            {
+                for ( sal_uInt16 i = 1; true; ++i )
+                {
+                    SfxShell *pSfxShell = rDispatcher.GetShell( i );
+                    // does the stack contain any shells spawned by this SwView already?
+                    if  ( ( dynamic_cast< const SwBaseShell *>( pSfxShell ) !=  nullptr
+                         || dynamic_cast< const FmFormShell  *>( pSfxShell ) !=  nullptr )
+                         && ( pSfxShell->GetViewShell() == this ) )
+                    {
+                        // it shouldn't b/c we haven't been activated yet
+                        // so assert that 'cause it'll crash during dispose at the latest
+                        assert( pSfxShell && "Corrupted shell stack: dependent shell positioned below its view");
+                    }
+                    else
+                        break;
+                }
+            }
+        }
+
         m_pWrtShell->ShellGetFocus();     // Selections visible
 
         if( !m_sSwViewData.isEmpty() )
commit 00842da2f04bf485452b2dbaf51a4f3ccaf1d9f8
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Feb 15 14:06:48 2018 +0100

    gtk3_kde5: Checkboxes on the left, texts on the right
    
    QFormLayout does it the other way round (text left, checkbox right)
    and it looks odd, so use QGridLayout
    
    Change-Id: Iff4255f695ce17561bac44e496a3567e1b438581
    Reviewed-on: https://gerrit.libreoffice.org/49815
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit 3b93b176572971f00845e268c12eef94190d03bc)

diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
index f587ecf7667b..ac8a1fec8183 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker.cxx
@@ -28,7 +28,7 @@
 #include <QtGui/QWindow>
 #include <QtWidgets/QCheckBox>
 #include <QtWidgets/QFileDialog>
-#include <QtWidgets/QFormLayout>
+#include <QtWidgets/QGridLayout>
 #include <QtWidgets/QWidget>
 #include <QtWidgets/QApplication>
 
@@ -38,7 +38,7 @@ KDE5FilePicker::KDE5FilePicker(QObject* _parent)
     : QObject(_parent)
     , _dialog(new QFileDialog(nullptr, {}, QDir::homePath()))
     , _extraControls(new QWidget)
-    , _layout(new QFormLayout(_extraControls))
+    , _layout(new QGridLayout(_extraControls))
     , _winId(0)
     , allowRemoteUrls(false)
 {
@@ -197,13 +197,14 @@ QString KDE5FilePicker::getLabel(sal_Int16 controlId) const
 
 void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool hidden)
 {
-    auto widget = new QCheckBox(_extraControls);
+    auto resString = label;
+    resString.replace('~', '&');
+
+    auto widget = new QCheckBox(resString, _extraControls);
     widget->setHidden(hidden);
     if (!hidden)
     {
-        auto resString = label;
-        resString.replace('~', '&');
-        _layout->addRow(resString, widget);
+        _layout->addWidget(widget);
     }
     _customWidgets.insert(controlId, widget);
 }
diff --git a/vcl/unx/gtk3_kde5/kde5_filepicker.hxx b/vcl/unx/gtk3_kde5/kde5_filepicker.hxx
index 17a37b7e27a3..d999f7bf7a09 100644
--- a/vcl/unx/gtk3_kde5/kde5_filepicker.hxx
+++ b/vcl/unx/gtk3_kde5/kde5_filepicker.hxx
@@ -28,7 +28,7 @@
 
 class QFileDialog;
 class QWidget;
-class QFormLayout;
+class QGridLayout;
 
 class KDE5FilePicker : public QObject
 {
@@ -51,7 +51,7 @@ protected:
     QWidget* _extraControls;
 
     //layout for extra custom controls
-    QFormLayout* _layout;
+    QGridLayout* _layout;
 
     sal_uIntPtr _winId;
 


More information about the Libreoffice-commits mailing list