[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - chart2/source

Stephan Bergmann sbergman at redhat.com
Fri Jan 23 03:49:58 PST 2015


 chart2/source/tools/TitleHelper.cxx |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit b0b6abf9596c5d5baa73439aa0c03467b8126469
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jan 23 12:09:55 2015 +0100

    Allow for null xModel in TitleHelper::getTitle
    
    Witnessed a JunitTest_chart2_unoapi failure where (deep within Idle::Timeout)
    chart::impl::ModelState::update is apparently called with a null xModel.  All
    the code called from there appears to be careful to handle a null xModel, except
    for chart::TitleHelper::getTitle, which---presumably by accident---stopped doing
    so with 401f01caf5b357ac6c15b37a89c0a9aaeb46f4e4 "use ChartModel instead of
    XModel in a few places."
    
    Change-Id: I5788b5e41a6d68fe193cb214d736ee54c4c581d7
    (cherry picked from commit 6acfc822566ca3c7d9fdd4af37ad5104a00d5d35)
    Reviewed-on: https://gerrit.libreoffice.org/14126
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index 26bffc3..3c58947 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -152,19 +152,19 @@ uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIn
 uno::Reference< XTitle > TitleHelper::getTitle( TitleHelper::eTitleType nTitleIndex
                             , const uno::Reference< frame::XModel >& xModel )
 {
+    uno::Reference< XTitled > xTitled;
     if(nTitleIndex == TitleHelper::MAIN_TITLE)
     {
-        uno::Reference< XTitled > xTitled( xModel, uno::UNO_QUERY );
-        return xTitled->getTitleObject();
+        xTitled.set( xModel, uno::UNO_QUERY );
+    }
+    else
+    {
+        uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
+        uno::Reference< XDiagram > xDiagram;
+        if( xChartDoc.is())
+            xDiagram.set( xChartDoc->getFirstDiagram());
+        xTitled = lcl_getTitleParent( nTitleIndex, xDiagram );
     }
-
-    uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
-    uno::Reference< XDiagram > xDiagram;
-
-    if( xChartDoc.is())
-        xDiagram.set( xChartDoc->getFirstDiagram());
-
-    uno::Reference< XTitled > xTitled( lcl_getTitleParent( nTitleIndex, xDiagram ) );
     if( xTitled.is())
         return xTitled->getTitleObject();
     return NULL;


More information about the Libreoffice-commits mailing list