Autorecovery problem:
- After an anomalous crash LO shows dialog that it will save and recover files on next launch.
- LO shows autorecovery dialog on next launch as expected.
- User selects option to go ahead and recover files listed.
- As it loads, a file with macros executes the macros (without normal permission request?) but macros fail when invoking getSheets() method from ThisComponent.
The recovery can become unmanageable (dismissing BASIC error reports), and practically LO must be terminated via Task Manager, which could endanger file recovery.
The full UDF that fails, with a comment where BASIC reports the error:
Function SheetName(Optional sheetIndex As Variant)
Dim Result As Variant
Dim Row As Integer
Dim Column As Integer
Dim Index as Variant
If IsMissing(sheetIndex) Then
SheetName = ThisComponent.CurrentController.Activesheet.Name
Exit Function
ElseIf IsEmpty(sheetIndex) Then
SheetName = ThisComponent.CurrentController.Activesheet.Name
Exit Function
ElseIf IsNull(sheetIndex) Then
SheetName = ThisComponent.CurrentController.Activesheet.Name
Exit Function
End If
If IsArray(sheetIndex) Then
ReDim Result(LBound(sheetIndex) to UBound(sheetIndex), LBound(sheetIndex,2) to UBound(sheetIndex,2))
For Row = LBound(sheetIndex,1) to UBound(sheetIndex,1)
For Column = Lbound(sheetIndex,2) to UBound(sheetIndex,2)
REM Specifically, empty entries in sheetIndex() will be "", the empty string
If IsNumeric(sheetIndex(Row, Column)) Then
Index = sheetIndex(Row, Column) - 1
If (Index >= 0) And (Index < ThisComponent.Sheets.Count) Then
Result(Row, Column) = ThisComponent.Sheets(Index).getName
Else
Result(Row, Column) = AsErr(502)
End If
End If
Next Column
Next Row
SheetName = Result
Else
If IsNumeric(sheetIndex) Then
Index = sheetIndex - 1
If Index <= ThisComponent.getSheets().Count - 1 Then 'FAILS HERE ONLY ON AUTORECOVERY
SheetName = ThisComponent.Sheets(Index).getName
Else
'NOP
EndIf
Else
SheetName = AsErr(502)
End If
End If
End Function
I’ll take advice on how this could be narrowed down, as it requires a crash to initiate the chain of events. I seem to recall similar experiences going back to early 7.x.
Version: 24.8.1.2 (X86_64) / LibreOffice Community
Build ID: 87fa9aec1a63e70835390b81c40bb8993f1d4ff6
CPU threads: 20; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded