https://issues.apache.org/ooo/show_bug.cgi?id=97539

--- Comment #5 from [email protected] ---
Call me a little crazy, but I have an even shorter macro. I expect that the
problem is related to the use of the variant data type and how assignment works
with arrays. For example, this little bit also crashes, and it is much shorter:

REM  *****  BASIC  *****
Option explicit

' This crashes OOo
Function crashMe() As Variant 
    Dim oMerged()
    oMerged = getMergedArea()
    msgbox (oMerged(2) - 0)
    crashMe() = oMerged(2) - 0
End Function

Function getMergedArea()
    Dim oRangeAddress As New com.sun.star.table.CellRangeAddress
    getMergedArea = array (oRangeAddress.StartColumn, _
                oRangeAddress.StartRow, _
            oRangeAddress.EndColumn, _
            oRangeAddress.EndRow)
End Function 

So, first we create a CellRangeAddress and then pull four long values out. We
use Array to create an array. What is returned is a Variant array with four
long values. This is returned as a variant type (because getMergedArea returns
a Variant). So, ultimately, a variant references an array, that contains an
array of Longs. If I change getMergedArea() to use hard coded long values, the
problem does not occur:

Dim l As Long : l = 0
getMergedArea = Array(l, l, l, l)

Clearly something crazy is occurring. I will attach a Calc document containing
a macro that fails.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to