The issue occurs when you get on the WaitEvent or CheckEvent(s) command in a script after freeing a display with events in queue. On MorphOS the usual error is "Function ??() not found!", which seems to make a clean exit, but on OS4 the whole program crashes in a nasty way making a Guru Mediation error popping up in a Grim Reaper window.
This didn't happen with Hollywood 8.0, but happens with 9.0 or later. I guess it's related to new event handling code in Hollywood.
BTW. is there a way to clear the event queue somehow, without running callback functions? I didn't succeed with BreakEventHandler etc...
Code: Select all
Function p_Input(msg)
Switch msg.action
Case "OnKeyUp":
Switch msg.key
Case "f":
p_Fullscreen()
EndSwitch
EndSwitch
EndFunction
Function p_Fullscreen()
fs = 1 - fs
If fs
CreateDisplay(2, {Mode="Fullscreen", Width=#NATIVE, Height=#NATIVE, Borderless=True, HidePointer=True})
OpenDisplay(2)
ActivateDisplay(2)
InstallEventHandler({OnKeyUp = p_Input})
Print("Press the f key at least twice within 2 seconds when this display opens.")
; To simulate that something time consuming is done after opening the display.
; You may get several input events in the queue before the function returns.
Wait(100)
Else
SelectDisplay(1, True)
FreeDisplay(2)
; Events for the freed display are left in the queue and causing an issue?
; The WaitEvent line exits with the error "40: Function ??() not found!" on MorphOS,
; and just crashes on OS4 (Grim Reaper/Guru Mediation/DSI error).
; This doesn't happen with Hollywood 8.0, but happens since 9.0 (new event handler code?)
EndIf
EndFunction
InstallEventHandler({OnKeyUp = p_Input})
Print("Press the f key for fullscreen.")
Repeat
WaitEvent
Forever