https://bugs.documentfoundation.org/show_bug.cgi?id=172189

            Bug ID: 172189
           Summary: ScriptForge Crash: Exception.ConsoleClear/427, Reason:
                    Object variable not set
           Product: LibreOffice
           Version: 25.8.7.3 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

I am attempting to use ScriptForge's Exception script service (unsure if that's
the correct title/name) to emulate a debug window in a LibreOffice Calc BASIC
function I am trying to make work, and it works the first time, but on
subsequent runs, it crashes, or something to that effect.  I get a popup dialog
that says this:

> Library :   ScriptForge
> Service :   Exception
> Method :    ConsoleClear
> 
> 
> The ScriptForge library has crashed. The reason is unknown.
> Maybe a bug that could be reported on
>     https://bugs.documentfoundation.org/
> 
> More details : 
> 
> Location : Exception.ConsoleClear/427
> Object variable not set.
> 
> 
> THE EXECUTION IS CANCELLED.

This code triggers the crash on the second iteration:

> ' Top of module.
> Dim sf As Object
> 
> ' Init sub.
> Sub LoadSF()
>     If sf Is Nothing Then
>         GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
>         sf = CreateScriptService("Exception")
>     End If
> End Sub
> 
> ' Test function.
> Function Foo(ByVal Bar As Long) As String
>     ' Init ScriptForge.
>     LoadSF
> 
>     ' Clear the console.
>     ' Works the first time, crashes thereafter.
>     sf.ConsoleClear()
> 
>     ' Do Something.
>     Dim i as Long
>     For i = 0 to 4 Step 1
>         sf.DebugPrint(i)
>     Next i
> 
>     ' Show the console window.
>     sf.Console()
> 
>     ' Return
>     Foo = "FOO"
> End Function


In a cell, add "=Foo(42)", run it, a ScriptForge dialog window, that is modal
to the application, appears and shows five lines:

> 22:34:34 -> 0
> 22:34:34 -> 1
> 22:34:34 -> 2
> 22:34:34 -> 3
> 22:34:34 -> 4

Close the window, hit Ctrl+Shift+F9 to force the function to run again, and the
crash dialog appears.  I have been unable to find a workaround other than
completely closing LibreOffice Calc and the BASIC IDE window down and
restarting it.  Which is mildly inconvenient for a debug workflow.  

If I avoid calling ConsoleClear() and just make extra DebugPrint() calls to pad
the log a bit, I can kinda manage around it, but I truly do miss VBA's
Debug.Print() to the Immediates pane in this instance.

Is there any timeline or possibility of getting an Immediates-type window that
supports Debug.Print() added to the BASIC IDE?  That and a built-in Object
Browser are the two key missing features, I think.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to