Resetting parameters in this function was introduced in commit
0b21b8b146 (initial commit for vba blob
( not including container_control stuff ), 2010-10-06). Unfortunately,
the reason for that is not explained.
The problem that it creates is that this code gets called eventually
from SbiRuntime::FindElement (which sets parameters using SetupArgs,
then calls SbiRuntime::CheckArray in the end, which calls GetObject,
which performs actual data access).
In SbiRuntime::CheckArray, the immediate problem was, that parameters
were referenced using a raw pointer; when the parageters were cleared
in GetObject, the pointer got dangling.
But it wasn't enough to use e.g. SbxArrayRef there, to keep the array
alive; the object will be accessed later, and needs its parameters to
work. On the other hand, it feels wrong to reinstate parameters after
the call to GetObject in SbiRuntime::CheckArray (getting the object
can run just any code path). So I chose to try and drop the resetting
of parameters in SbUnoObject::Notify. Let's see, if something breaks.
Change-Id: Icadfcfb8b7e5e87b2de46166963fd97532f8713c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186432
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
49 lines
1.4 KiB
VB.net
49 lines
1.4 KiB
VB.net
' 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/.
|
|
'
|
|
|
|
Option Explicit
|
|
|
|
Function doUnitTest() As String
|
|
TestUtil.TestInit
|
|
verify_testVbscript_RegExp
|
|
doUnitTest = TestUtil.GetResult()
|
|
End Function
|
|
|
|
Sub verify_testVbscript_RegExp()
|
|
On Error GoTo errorHandler
|
|
|
|
If GetGuiType() <> 1 Then ' Only testing on Windows
|
|
TestUtil.Assert(True) ' Mark test as succeeded
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim txt, regex, matches, item1, item2
|
|
|
|
txt = "This is LibreOffice for you"
|
|
|
|
regex = CreateObject("VBScript.RegExp")
|
|
regex.Pattern = "(Li.+)(Of\w+)"
|
|
|
|
matches = regex.Execute(txt)
|
|
|
|
' Test that accessing twice an indexed property (here: Item) of a COM object works
|
|
If matches.Count > 0 Then
|
|
item1 = matches.Item(0).SubMatches.Item(0)
|
|
' Without the fix, the following line errored out:
|
|
' Type: com.sun.star.lang.WrappedTargetRuntimeException
|
|
' Message: [automation bridge] unexpected exception in IUnknownWrapper::getValue
|
|
item2 = matches.Item(0).SubMatches.Item(1)
|
|
End If
|
|
|
|
TestUtil.AssertEqual(item1, "Libre", "item1")
|
|
TestUtil.AssertEqual(item2, "Office", "item2")
|
|
|
|
Exit Sub
|
|
errorHandler:
|
|
TestUtil.ReportErrorHandler("verify_testVbscript_RegExp", Err, Error$, Erl)
|
|
End Sub
|