Canvas firing Paint Event until Crashing the app in Mojave

Hello Guys,

Using XOJO 2018R4

I have an app that shows some photos in a Canvas as preview.

High Sierra all nice and smooth , same code in Mojave is crashing the app straight with the error :

[quote]Date/Time: 2018-12-20 17:26:25.392 +0100
OS Version: Mac OS X 10.14.2 (18C54)
Report Version: 12

Time Awake Since Boot: 2200 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Illegal instruction: 4
Termination Reason: Namespace SIGNAL, Code 0x4
Terminating Process: exc handler [908]

Application Specific Information:
Crashing on exception: The window has been marked as needing another Display Window pass, but it has already had more Display Window passes than there are views in the window.[/quote]

Any idea what this could be ?

So doing some tests , in High Sierra , the Modal window shows, loads the pictures and displays and all, while in Mojave same code is calling Paint event several it crashes with that error .

Did something changed in the last update related to Canvas ? and Mojave ?

Thanks.

in you PAINT event… .do you have ANYTHING the takes focus away from the Canvas?

MSGBOX? xxx.show? ANYTHING at all.

If you remove focus from a CANVAS during paint for any reason, it will run the paint event again, and then focus is remove, and it fires again etc. etc. etc.

[quote=418722:@Dave S]in you PAINT event… .do you have ANYTHING the takes focus away from the Canvas?

MSGBOX? xxx.show? ANYTHING at all.

If you remove focus from a CANVAS during paint for any reason, it will run the paint event again, and then focus is remove, and it fires again etc. etc. etc.[/quote]
Hi Dave,

Nothing at all, except the end line which is Me.Invalidate and I tried with and without False and same thing. I will try without Invalidating the Canvas to see how it goes.

THAT causes PAINT to fire again… remove it completely

And it works, Is that a bug or what ? in High Sierra is working perfectly it seems .

Thanks.

The “bug” is the High Sierra SHOULD have reacted the same way.

Invalidate says “Hey run PAINT when you get a chance”… It defers until the end of a run cycle

Well, the last line of the PAINT event IS the end of a run cycle… so at the end of PAINT you are saying “Run Paint”

[quote=418730:@Dave S]The “bug” is the High Sierra SHOULD have reacted the same way.

Invalidate says “Hey run PAINT when you get a chance”… It defers until the end of a run cycle

Well, the last line of the PAINT event IS the end of a run cycle… so at the end of PAINT you are saying “Run Paint”[/quote]
Got it , thanks.