[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - basic/qa basic/source

Noel Power noel.power at suse.com
Thu Feb 7 01:32:20 PST 2013


 basic/qa/basic_coverage/uno_struct_assign.vb |   15 +++++++++++++++
 basic/source/runtime/step0.cxx               |   10 ++++++++++
 2 files changed, 25 insertions(+)

New commits:
commit 6644caf9048495ddb6174d7ec30daa7e20e2828e
Author: Noel Power <noel.power at suse.com>
Date:   Tue Feb 5 10:25:49 2013 +0000

    fix for fdo#60065
    
    squash errors trying to gain object for rhs ( where no object yet exists (
    
    Change-Id: I81548d1c6a32f0445dc18e31c84c3df85163ed45
    Reviewed-on: https://gerrit.libreoffice.org/2003
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>

diff --git a/basic/qa/basic_coverage/uno_struct_assign.vb b/basic/qa/basic_coverage/uno_struct_assign.vb
new file mode 100644
index 0000000..23812de
--- /dev/null
+++ b/basic/qa/basic_coverage/uno_struct_assign.vb
@@ -0,0 +1,15 @@
+'
+' This file is part of the LibreOffice project.
+'
+' This Source Code Form is subject to the terms of the Mozilla Public
+' License, v. 2.0. If a copy of the MPL was not distributed with this
+' file, You can obtain one at http://mozilla.org/MPL/2.0/.
+'
+
+
+Function doUnitTest as Integer
+  Dim oNamedValue as new com.sun.star.beans.NamedValue 
+  Dim oCellAddress as new com.sun.star.table.CellAddress
+  oNamedValue.Value = oCellAddress ' fdo#60065 - this would throw an error
+  doUnitTest = 1
+End Function
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 5e41425..2388722 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -388,7 +388,17 @@ inline bool checkUnoStructCopy( bool bVBA, SbxVariableRef& refVal, SbxVariableRe
     if (  aAny.getValueType().getTypeClass() == TypeClass_STRUCT )
     {
         refVar->SetType( SbxOBJECT );
+        SbxError eOldErr = refVar->GetError();
+        // There are some circumstances when calling GetObject
+        // will trigger an error, we need to squash those here.
+        // Alternatively it is possible that the same scenario
+        // could overwrite and existing error. Lets prevent that
         SbxObjectRef xVarObj = (SbxObject*)refVar->GetObject();
+        if ( eOldErr != SbxERR_OK )
+            refVar->SetError( eOldErr );
+        else
+            refVar->ResetError();
+
         SbUnoStructRefObject* pUnoStructObj = PTR_CAST(SbUnoStructRefObject,(SbxObject*)xVarObj);
 
         if ( ( !pUnoVal && !pUnoStructVal ) )


More information about the Libreoffice-commits mailing list