[Libreoffice-commits] core.git: sfx2/source

Michael Stahl mstahl at redhat.com
Tue Jul 14 04:47:22 PDT 2015


 sfx2/source/sidebar/SidebarController.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit c32333aed6286b6f42f2a491759a559732d0b8b2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 14 13:25:44 2015 +0200

    sfx2: tolerate frames without controller in GetSidebarControllerForFrame
    
    Unfortnately happens in CppunitTest_writerperfect_draw for Draw docs.
    
    Change-Id: I1317d30d71fa5975564d1060cbf8958f63b67f40

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 3831023..a87b653 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -149,8 +149,14 @@ SidebarController::~SidebarController()
 SidebarController* SidebarController::GetSidebarControllerForFrame (
     const css::uno::Reference<css::frame::XFrame>& rxFrame)
 {
+    uno::Reference<frame::XController> const xController(rxFrame->getController());
+    if (!xController.is()) // this may happen during dispose of Draw controller but perhaps it's a bug
+    {
+        SAL_WARN("sfx2.sidebar", "GetSidebarControllerForFrame: frame has no XController");
+        return nullptr;
+    }
     uno::Reference<ui::XContextChangeEventListener> const xListener(
-        framework::GetFirstListenerWith(rxFrame->getController(),
+        framework::GetFirstListenerWith(xController,
             [] (uno::Reference<uno::XInterface> const& xRef)
             { return nullptr != dynamic_cast<SidebarController*>(xRef.get()); }
         ));


More information about the Libreoffice-commits mailing list