Error at Canvas.Invalidate instruction

Hi,

I wanted to report a bug to Xojo, but I am working with Xojo 2017.2.1, whereas the bug reporter requires at least 2017.3. So I have to report it here I think.

When quitting my application on Mac, I got an EXC_BAD_ACCESS. I think the error happened at the following level:

0 XojoFramework 0x0000000105ae1928 RuntimeControlInvalidate + 31

The application first triggers a timer which calls a method. The method calls another method which makes some queries. At the end of this method there is a Canvas.Invalidate instruction, and I guess that the application crashed at that point. The crash happened only once until now. The timer runs every 2 seconds.

The exception code which I get is EXC_I386_GPFLT, which apparently means General Protection Fault, and it seems to be related to the way my application is built, which is 64-bit.

In a forum I read the following explanation:

[i]If it is a 64-bit system, a plausible scenario is that your code is using a “non-canonical pointer” - meaning that a 64-bit address is formed in such a way that the upper 16 bits of the address aren’t all copies of the top of the lower 48 bits (in other words, the top 16 bits of an address should all be 0 or all 1, based on the bit just below 16 bits). This rule is in place to guarantee that the architecture can “safely expand the number of valid bits in the address range”. This would indicate that the code is either overwriting some pointer data with other stuff, or going out of bounds when reading some pointer value.

Another likely cause is unaligned access with an SSE register - in other words, reading a 16-byte SSE register from an address that isn’t 16-byte aligned.

There are, as I said, many other possible reasons, but most of those involve things that “normal” code wouldn’t be doing in a 32- or 64-bit OS (such as loading segment registers with invalid selector index or writing to MSR’s (model specific registers)).[/i]

If you have a property with a reference to a control and you close the window and than call a method or set a property on the control, you get a crash:

dim w as new window1 w.show dim p as PushButton = w.PushButton1 w.close p.Enabled = false

with crash log:

[quote]Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 XojoFramework 0x004753dd controlEnabledSetter + 39
1 test.debug 0x0004b929 RectControl.Enabled.Set%%oi4b + 71
2 test.debug 0x000d89a0 App.Event_Open%%o + 422[/quote]

[quote=366470:@Christian Schmitz]If you have a property with a reference to a control and you close the window and than call a method or set a property on the control, you get a crash:

dim w as new window1 w.show dim p as PushButton = w.PushButton1 w.close p.Enabled = false

with crash log:[/quote]

I think that you are right if it is true that the timer runs one more cycle following the close event of the window.

Feedback doesn’t “require” 2017r3, we just want you to test your bug in the latest version before reporting it, because if it’s already fixed, we would like to not put the energy into it.

And no, you should not report bugs to Xojo here. We don’t track conversations on the forum as if they were bug reports. If you want it fixed, it must be in Feedback.

I’ve run into a similar issue with placing invalidate calls at the end of methods and haven’t been able to figure out the root cause.

The way that I’ve always gotten around it is to put the invalidate command into a timer with a period of 1ms and set that timer’s mode to single where I would have otherwise done the invalidate call.