Access Violation Post-Mortum

I was getting an Access Violation hard crash in my large, complex app on Windows. It worked fine on MacOS, and it previously worked fine on Windows.

I spent nearly a week trying everything I could think of, including reverting to previous versions of Xojo, previous plugin versions, even an old version of my project that I knew to be working… They all crashed with an Access Violation after my Window.Opening event, somewhere the debugger couldn’t show.

After much hair-ripping, I finally figured out it was a single instance of a DesktopHTMLViewer.

I removed all events from that DesktopHTMLViewer and the Access Violation still happened, it’s mere presence on the window was enough to crash the app.

I removed it, placed a new DesktopHTMLViewer and gave it the same name, then pasted the old object’s events into it, and now the app works without issue.

Now I just want to know what happened. What on earth could corrupt an instance of a DesktopHTMLViewer that would cause an Access Violation crash on Windows but be fine on MacOS?

After a couple more hours of poking around, I think I have my answer. It has something to do with z-order.

The DesktopHTMLViewer in this project causes an Access Violation if it is not above some other Control in my list of over 100 controls on the window. If I just bring it to the top in z-order the crash goes away. If I send it to the back, it comes back.

Truly weird.

Edit: Fixing this also fixed a freezing issue I was having on a completely different window. Mind is blown right now!

2 Likes

Do you mean you changed the Tab-Order-Editor order?