HiDPI / Retina and NilObjectException


I have a question: I have a window with a TextArea and a Tab-panel with three tabs.

When I switch ‘Supports Hi-DPI’ on, the app crashes on ‘Window1.show’ with: An exception of class NilObjectException was not handled. The application must shut down.
What I see on screen is that Window1 has been opened and is visible, the List is present on that window, but the Tab-panel is not.
So I suspect the crash occurs possible because of the Tab-panel.

Inside the three tabs, there are only these normal controls: TextFields, TextAreas, PopupMenus, CheckBoxes, RadioButtons and PushButtons.

There are no graphics or images on that window nor inside the three tabs.
I tried to compile with the 64-bit switched on, but I got the same error on the same line.

Does someone have a clue what can be the cause?

Is TabPannel Index 0-based and you are calling to show Tab-Pannel #3 (or #4) ?


No, I’m not calling anything.
I set a breakpoint on the first line of the ‘Open’-event of ‘Window1’, but it doesn’t even get there.

Sounds like it’s time to file a Feedback report!

Do you have code in the Open event handlers for any of the controls? Those events happen before the window’s Open event. In particular, you will run into problems if the control Open event handlers refer to other controls on the window.

Are you running this in the debugger or a built application?

Are you sure ? Controls form before the window Open event.

Usually, it is the other way around that crashes, like referring to other controls in a control open event.

That said, if it does not happen in 32 bit, I don’t think 64 bit changes much the order of events.

I think we are saying the same thing. Maybe I didn’t express myself clearly.

The OP said it happened with or without the 64-bit setting on. Turning on HiDPI is apparently what makes it crash; not that this setting is likely to change the event order either.

I’m betting this has to do with the fact that the images are now immutable and the Graphics property is now Nil.

It happens with the debugger and the compiled version. As I see it now, it happens during the window-opening process, because, as I wrote, the window is indeed opened, the first control (the textarea) is visible and then it crashes. And that moment is when it is building the tabbed-control.

And as said, no pictures or graphics. Just standard controls.

So when the debugger stops for the NilObjectException, are you saying that the code view is blank?

I don’t know what you mean exactly, but in the debugger the little red bug shows up at the line : Window1.show

What is the position of ImplicitInstance on your Window1? Did you switch it off incidentally?
(Doesn’t sound so because you say it opens; but there must be a reason the debugger stops there with that exception.)

I never new that switch existed until today. I’m not at my computer but would it make a difference with HiDPI ?

No, it would cause an exception under low res as well. Was just a wild guess.
Is it possible to make a small project just with that window? Does it crash too?
And like Urs asked: Do your controls have open event handlers?
Did you examine the system crash log?

Its the icons in your toolbar. Convert them to Images (right-click > Convert to Image).

Ok, thank you very much for looking into it and finding the answer!
I was mislead by what I saw on screen and totally forgot about the toolbar :-}

Is it possible to check for such requirements during compile time instead of during runtime?

Honestly this is a bug and should be reported. We didn’t intend that flipping that switch would cause exceptions like this.

Cant reproduce this according to your bug report
Please attach a sample that shows this issue

@Norman Palardy I sent you the project file Greg tested with via Feedback.