# Canvas firing Paint Event until Crashing the app in Mojave

**URL:** <https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745>\
**Category:** macOS\
**Created:** [December 20, 2018, 4:35pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745 "2018-12-20T16:35:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aurelian\_N](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@Aurelian\_N](https://forum.xojo.com/u/Aurelian_N)\
**Post date:** [December 20, 2018, 4:35pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/1 "2018-12-20T16:35:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [December 20, 2018, 4:40pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/2 "2018-12-20T16:40:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Aurelian\_N](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@Aurelian\_N](https://forum.xojo.com/u/Aurelian_N)\
**Post date:** [December 20, 2018, 4:49pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/3 "2018-12-20T16:49:16Z")

</div>

[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.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [December 20, 2018, 4:51pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/4 "2018-12-20T16:51:19Z")

</div>

> [@418724:@Aurelian Negrea](#):
>
> Me.Invalidate

THAT causes PAINT to fire again… remove it completely

---

<div class="post-metadata">

**Author:** ![Aurelian\_N](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@Aurelian\_N](https://forum.xojo.com/u/Aurelian_N)\
**Post date:** [December 20, 2018, 4:52pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/5 "2018-12-20T16:52:17Z")

</div>

> [@418726:@Dave S](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [December 20, 2018, 4:55pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/6 "2018-12-20T16:55:12Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![Aurelian\_N](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/b4bc9f/32.png) [@Aurelian\_N](https://forum.xojo.com/u/Aurelian_N)\
**Post date:** [December 20, 2018, 7:08pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/7 "2018-12-20T19:08:23Z")

</div>

[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.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:30pm UTC](https://forum.xojo.com/t/canvas-firing-paint-event-until-crashing-the-app-in-mojave/46745/8 "2020-10-29T19:30:08Z")

</div>


