kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone

Blame SOURCES/0114-LOK-Avoid-crash-when-the-command-is-not-available-in.patch

f325b2
From a673fc9e4b1d04c26a486caa8babf7bd003d5b38 Mon Sep 17 00:00:00 2001
f325b2
From: Jan Holesovsky <kendy@collabora.com>
f325b2
Date: Tue, 15 Sep 2015 17:04:58 +0200
f325b2
Subject: [PATCH 114/398] LOK: Avoid crash when the command is not available in
f325b2
 the given component.
f325b2
f325b2
In that case we get a NULL pSlot.
f325b2
f325b2
Change-Id: I38783ed198b1ab9860398f59ef872a295cbae6f8
f325b2
(cherry picked from commit a191076e3b4063a074ebf1a4ef4cded25cebdb8c)
f325b2
---
f325b2
 desktop/source/lib/init.cxx | 23 +++++++++--------------
f325b2
 1 file changed, 9 insertions(+), 14 deletions(-)
f325b2
f325b2
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
f325b2
index e56284cdb7cb..87471454b5d2 100644
f325b2
--- a/desktop/source/lib/init.cxx
f325b2
+++ b/desktop/source/lib/init.cxx
f325b2
@@ -555,7 +555,7 @@ static void doc_iniUnoCommands ()
f325b2
     util::URL aCommandURL;
f325b2
     const SfxSlot* pSlot = NULL;
f325b2
     SfxViewShell* pViewShell = SfxViewShell::Current();
f325b2
-    SfxViewFrame* pViewFrame = (pViewShell ? pViewShell->GetViewFrame() : NULL);
f325b2
+    SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): NULL;
f325b2
 
f325b2
     // check if Frame-Controller were created.
f325b2
     if (!pViewShell && !pViewFrame)
f325b2
@@ -564,26 +564,21 @@ static void doc_iniUnoCommands ()
f325b2
         return;
f325b2
     }
f325b2
 
f325b2
-    SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pViewFrame );
f325b2
-    uno::Reference<util::XURLTransformer> xParser =
f325b2
-        util::URLTransformer::create(xContext);
f325b2
+    SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
f325b2
+    uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(xContext));
f325b2
 
f325b2
-    for (
f325b2
-        sal_uInt32 nIterator = 0;
f325b2
-        nIterator < SAL_N_ELEMENTS(sUnoCommands);
f325b2
-        nIterator++
f325b2
-        )
f325b2
+    for (sal_uInt32 nIterator = 0; nIterator < SAL_N_ELEMENTS(sUnoCommands); nIterator++)
f325b2
     {
f325b2
         aCommandURL.Complete = sUnoCommands[nIterator];
f325b2
         xParser->parseStrict(aCommandURL);
f325b2
         pSlot = rSlotPool.GetUnoSlot(aCommandURL.Path);
f325b2
 
f325b2
-        // Initialize slot to dispatch Uno Command.
f325b2
-        uno::Reference<frame::XDispatch> xDispatch =
f325b2
-            pViewFrame->GetBindings().GetDispatch( pSlot, aCommandURL, false );
f325b2
-        if (!xDispatch.is())
f325b2
+        // when null, this command is not supported by the given component
f325b2
+        // (like eg. Calc does not have ".uno:DefaultBullet" etc.)
f325b2
+        if (pSlot)
f325b2
         {
f325b2
-            SAL_WARN("lok", "iniUnoCommands: No XDispatch interface : " + aCommandURL.Complete);
f325b2
+            // Initialize slot to dispatch .uno: Command.
f325b2
+            pViewFrame->GetBindings().GetDispatch(pSlot, aCommandURL, false);
f325b2
         }
f325b2
     }
f325b2
 }
f325b2
-- 
f325b2
2.12.0
f325b2