[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 3 commits - configure.ac sw/inc sw/source vcl/source

Gabriel Masei (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 14 06:48:49 UTC 2021


 configure.ac                     |    2 -
 sw/inc/strings.hrc               |    3 --
 sw/inc/view.hxx                  |    3 --
 sw/source/uibase/uiview/view.cxx |   35 -----------------------------
 vcl/source/window/mouse.cxx      |   19 +++++++++------
 vcl/source/window/toolbox.cxx    |    4 +--
 vcl/source/window/winproc.cxx    |   47 ++++++++++++++++++++++++---------------
 7 files changed, 44 insertions(+), 69 deletions(-)

New commits:
commit f1f0c101109bcf9b54a47bf1010376fd8736e56c
Author:     Gabriel Masei <gabriel.masei at 1and1.ro>
AuthorDate: Fri May 28 14:37:52 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 14 08:11:34 2021 +0200

    vcl: check mpWindowImpl before referencing it
    
    Fixed some cases generating crashes because mpWindowImpl was not checked for nullptr.
    
    Change-Id: I5540f9f21a870b02655b5bf2afdbf3a8153c1519
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116330
    Tested-by: Jenkins
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index fbe81aed7499..2a1583a3ba5c 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -252,7 +252,7 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
 
     bool bAsyncFocusWaiting = false;
     vcl::Window *pFrame = pSVData->maFrameData.mpFirstFrame;
-    while( pFrame  )
+    while( pFrame && pFrame->mpWindowImpl && pFrame->mpWindowImpl->mpFrameData )
     {
         if( pFrame != mpWindowImpl->mpFrameWindow.get() && pFrame->mpWindowImpl->mpFrameData->mnFocusId )
         {
@@ -275,6 +275,8 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
             bMustNotGrabFocus = true;
             break;
         }
+        if (!pParent->mpWindowImpl)
+            break;
         pParent = pParent->mpWindowImpl->mpParent;
     }
 
@@ -332,13 +334,16 @@ void Window::ImplGrabFocus( GetFocusFlags nFlags )
     else
     {
         vcl::Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
-        vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
-        pNewOverlapWindow->mpWindowImpl->mbActive = true;
-        pNewOverlapWindow->Activate();
-        if ( pNewRealWindow != pNewOverlapWindow )
+        if ( pNewOverlapWindow && pNewOverlapWindow->mpWindowImpl )
         {
-            pNewRealWindow->mpWindowImpl->mbActive = true;
-            pNewRealWindow->Activate();
+            vcl::Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
+            pNewOverlapWindow->mpWindowImpl->mbActive = true;
+            pNewOverlapWindow->Activate();
+            if ( pNewRealWindow != pNewOverlapWindow  && pNewRealWindow && pNewRealWindow->mpWindowImpl )
+            {
+                pNewRealWindow->mpWindowImpl->mbActive = true;
+                pNewRealWindow->Activate();
+            }
         }
     }
 
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 289f9e522954..11aab62126f6 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3050,7 +3050,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
         vcl::Window *pWin = pFocusWin->GetParent();
         while (pWin)
         {
-            if(pWin->ImplGetWindowImpl()->mbToolBox)
+            if(pWin->ImplGetWindowImpl() && pWin->ImplGetWindowImpl()->mbToolBox)
             {
                 bFocusWindowIsAToolBoxChild = true;
                 break;
@@ -3059,7 +3059,7 @@ void ToolBox::MouseMove( const MouseEvent& rMEvt )
         }
     }
 
-    if( bFocusWindowIsAToolBoxChild || (pFocusWin && pFocusWin->ImplGetWindowImpl()->mbToolBox && pFocusWin != this) )
+    if( bFocusWindowIsAToolBoxChild || (pFocusWin && pFocusWin->ImplGetWindowImpl() && pFocusWin->ImplGetWindowImpl()->mbToolBox && pFocusWin != this) )
         bDrawHotSpot = false;
 
     if ( mbDragging )
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index aab2cb21bb21..4e1f4f5117d3 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -810,17 +810,20 @@ static vcl::Window* ImplGetKeyInputWindow( vcl::Window* pWindow )
     vcl::Window* pChild = pSVData->mpWinData->mpFirstFloat;
     while (pChild)
     {
-        if (pChild->ImplGetWindowImpl()->mbFloatWin)
+        if (pChild->ImplGetWindowImpl())
         {
-            if (static_cast<FloatingWindow *>(pChild)->GrabsFocus())
-                break;
-        }
-        else if (pChild->ImplGetWindowImpl()->mbDockWin)
-        {
-            vcl::Window* pParent = pChild->GetWindow(GetWindowType::RealParent);
-            if (pParent && pParent->ImplGetWindowImpl()->mbFloatWin &&
-                static_cast<FloatingWindow *>(pParent)->GrabsFocus())
-                break;
+            if (pChild->ImplGetWindowImpl()->mbFloatWin)
+            {
+                if (static_cast<FloatingWindow *>(pChild)->GrabsFocus())
+                    break;
+            }
+            else if (pChild->ImplGetWindowImpl()->mbDockWin)
+            {
+                vcl::Window* pParent = pChild->GetWindow(GetWindowType::RealParent);
+                if (pParent && pParent->ImplGetWindowImpl()->mbFloatWin &&
+                    static_cast<FloatingWindow *>(pParent)->GrabsFocus())
+                    break;
+            }
         }
         pChild = pChild->GetParent();
     }
@@ -828,7 +831,7 @@ static vcl::Window* ImplGetKeyInputWindow( vcl::Window* pWindow )
     if (!pChild)
         pChild = pWindow;
 
-    pChild = pChild->ImplGetWindowImpl()->mpFrameData->mpFocusWin;
+    pChild = pChild->ImplGetWindowImpl() && pChild->ImplGetWindowImpl()->mpFrameData ? pChild->ImplGetWindowImpl()->mpFrameData->mpFocusWin.get() : nullptr;
 
     // no child - then no input
     if ( !pChild )
@@ -1757,6 +1760,9 @@ static void ImplActivateFloatingWindows( vcl::Window const * pWindow, bool bActi
 
 IMPL_LINK_NOARG(vcl::Window, ImplAsyncFocusHdl, void*, void)
 {
+    if (!ImplGetWindowImpl() || !ImplGetWindowImpl()->mpFrameData)
+        return;
+
     ImplGetWindowImpl()->mpFrameData->mnFocusId = nullptr;
 
     // If the status has been preserved, because we got back the focus
@@ -1815,22 +1821,27 @@ IMPL_LINK_NOARG(vcl::Window, ImplAsyncFocusHdl, void*, void)
             {
                 // transfer the FocusWindow
                 vcl::Window* pOverlapWindow = pFocusWin->ImplGetFirstOverlapWindow();
-                pOverlapWindow->ImplGetWindowImpl()->mpLastFocusWindow = pFocusWin;
+                if ( pOverlapWindow && pOverlapWindow->ImplGetWindowImpl() )
+                    pOverlapWindow->ImplGetWindowImpl()->mpLastFocusWindow = pFocusWin;
                 pSVData->mpWinData->mpFocusWin = nullptr;
 
-                if ( pFocusWin->ImplGetWindowImpl()->mpCursor )
+                if ( pFocusWin->ImplGetWindowImpl() && pFocusWin->ImplGetWindowImpl()->mpCursor )
                     pFocusWin->ImplGetWindowImpl()->mpCursor->ImplHide();
 
                 // call the Deactivate
                 vcl::Window* pOldOverlapWindow = pFocusWin->ImplGetFirstOverlapWindow();
                 vcl::Window* pOldRealWindow = pOldOverlapWindow->ImplGetWindow();
 
-                pOldOverlapWindow->ImplGetWindowImpl()->mbActive = false;
-                pOldOverlapWindow->Deactivate();
-                if ( pOldRealWindow != pOldOverlapWindow )
+                if (pOldOverlapWindow && pOldOverlapWindow->ImplGetWindowImpl() &&
+                    pOldRealWindow && pOldRealWindow->ImplGetWindowImpl())
                 {
-                    pOldRealWindow->ImplGetWindowImpl()->mbActive = false;
-                    pOldRealWindow->Deactivate();
+                    pOldOverlapWindow->ImplGetWindowImpl()->mbActive = false;
+                    pOldOverlapWindow->Deactivate();
+                    if ( pOldRealWindow != pOldOverlapWindow )
+                    {
+                        pOldRealWindow->ImplGetWindowImpl()->mbActive = false;
+                        pOldRealWindow->Deactivate();
+                    }
                 }
 
                 // TrackingMode is ended in ImplHandleLoseFocus
commit 2a32e47d31c3f8f477c5763351b3838b39a5410b
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Mon May 24 00:19:53 2021 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 14 08:11:04 2021 +0200

    Mail Merge: Remove the missing data source warning on load.
    
    User can easily forget that they (or somebody else ) added a
    data source to document. This warning is only useful for the
    user that plans to use mail merge wizard. When they don't plan
    to use mail merge wizard and see that warning on infobar they
    can confuse. We already have the same warning on mail merge
    dialog itself. We don't need on load warning anymore.
    
    Change-Id: I8d80148a9637ee66cc35e2ef583fff51a04386eb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116029
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 9a924698a82e..e5f20d867d2d 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1384,9 +1384,6 @@
 #define STR_AUTOMARK_NO                         NC_("createautomarkdialog|no", "No")
 
 #define STR_WRAP_PANEL_CUSTOM_STR               NC_("sidebarwrap|customlabel", "Custom")
-#define STR_DATASOURCE_NOT_AVAILABLE            NC_("STR_DATASOURCE_NOT_AVAILABLE", "Data source is not available. Mail merge wizard will not work properly.")
-#define STR_EXCHANGE_DATABASE                   NC_("STR_EXCHANGE_DATABASE", "Exchange Database")
-
 
 #endif
 
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 57c41b4a7971..fbad7499d28f 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -542,8 +542,6 @@ public:
     // form control has been activated
     DECL_LINK( FormControlActivated, LinkParamNone*, void );
 
-    DECL_LINK( ExchangeDatabaseHandler, weld::Button&, void);
-
     // edit links
     void            EditLinkDlg();
     void            AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId = nullptr);
@@ -615,7 +613,6 @@ public:
 
     OUString GetDataSourceName() const;
     static bool IsDataSourceAvailable(const OUString sDataSourceName);
-    void AppendDataSourceInfobar();
 
     void ExecFormatPaintbrush(SfxRequest const &);
     void StateFormatPaintbrush(SfxItemSet &);
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 8217a192d2cf..44a4b2414981 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -212,11 +212,6 @@ IMPL_LINK_NOARG(SwView, FormControlActivated, LinkParamNone*, void)
     }
 }
 
-IMPL_LINK_NOARG(SwView, ExchangeDatabaseHandler, weld::Button&, void)
-{
-    GetDispatcher().Execute(FN_CHANGE_DBFIELD);
-}
-
 namespace
 {
 uno::Reference<frame::XLayoutManager> getLayoutManager(const SfxViewFrame& rViewFrame)
@@ -1641,23 +1636,6 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     }
     else
     {
-        if (auto pSfxEventHint = dynamic_cast<const SfxEventHint*>(&rHint))
-        {
-            switch( pSfxEventHint->GetEventId() )
-            {
-                case SfxEventHintId::CreateDoc:
-                case SfxEventHintId::OpenDoc:
-                {
-                    OUString sDataSourceName = GetDataSourceName();
-                    if ( !sDataSourceName.isEmpty() && !IsDataSourceAvailable(sDataSourceName))
-                        AppendDataSourceInfobar();
-                }
-                break;
-                default:
-                    break;
-            }
-        }
-
         SfxHintId nId = rHint.GetId();
 
         switch ( nId )
@@ -1921,19 +1899,6 @@ bool SwView::IsDataSourceAvailable(const OUString sDataSourceName)
     return xDatabaseContext->hasByName(sDataSourceName);
 }
 
-void SwView::AppendDataSourceInfobar()
-{
-    auto pInfoBar = GetViewFrame()->AppendInfoBar("datasource", "",
-                                  SwResId(STR_DATASOURCE_NOT_AVAILABLE),
-                                  InfobarType::WARNING);
-    if (!pInfoBar)
-        return;
-
-    weld::Button& rBtn = pInfoBar->addButton();
-    rBtn.set_label(SwResId(STR_EXCHANGE_DATABASE));
-    rBtn.connect_clicked(LINK(this, SwView, ExchangeDatabaseHandler));
-}
-
 namespace sw {
 
 void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb)
commit 278d04f4bde2a8974f795e4b89951ae98abc80bd
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jan 20 16:06:59 2021 +0100
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 14 08:10:51 2021 +0200

    Avoid Clang -Werror,-Wunused-command-line-argument
    
    > [CXX] bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx
    > clang-12: error: argument unused during compilation: '-fno-stack-clash-protection' [-Werror,-Wunused-command-line-argument]
    
    as seen e.g. on macOS 11.1 ARM64 when building against Clang 12 trunk.  Clang
    supports -fstack-clash-protection on
    
    > $ clang --target=x86_64-unknown-linux-gnu -fstack-clash-protection -fsyntax-only -x c - </dev/null
    
    but not on e.g.
    
    > $ clang --target=aarch64-unknown-linux-gnu -fstack-clash-protection -fsyntax-only -x c - </dev/null
    > clang-12: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
    
    or
    
    > $ clang --target=arm64-apple-macosx11.0.0 -fstack-clash-protection -fsyntax-only -x c - </dev/null
    > clang-12: warning: argument unused during compilation: '-fstack-clash-protection' [-Wunused-command-line-argument]
    
    Change-Id: I98625bb7ed37bf00e97634c1c8d1f87fe3263af9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109719
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/configure.ac b/configure.ac
index cef4e660221c..9f7dbc1f3fd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6847,7 +6847,7 @@ HAVE_GCC_STACK_CLASH_PROTECTION=
 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
     save_CFLAGS=$CFLAGS
-    CFLAGS="$CFLAGS -fstack-clash-protection"
+    CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
     AC_LINK_IFELSE(
         [AC_LANG_PROGRAM(, [[return 0;]])],
         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],


More information about the Libreoffice-commits mailing list