Empty Runtime Exception closing window after closing DesktopColorPicker

Just tested new desktop color picker on macOS 11.2.3 and the IDE stops and shows a nil pointer exception on this line of code

w.ShowModalWithin(parent)

After calling the following code to close the window.

if ColorPicker1.IsVisible then DesktopColorPicker.Close()
close()

I have the following pragma set as well in the code showing the window.

#Pragma BreakOnExceptions false

I am guessing it’s some debug code as the runtime is not caught and keeps running next line of code.

Also documentation shows IsVisible is shared, it is a local property for DesktopColorPicker.

1 Like

It’s not. It’s a shared computed property so you can call it directly as:

If DesktopColorPicker.IsVisible then

Have you tried this?

Screen Shot 2021-04-22 at 3.56.42 PM

If ColorPicker1 is your DesktopColorPicker, shouldn’t this code

be

if ColorPicker1.IsVisible then ColorPicker1.Close

If that is not the problem, can you share a sample of your code that can reproduce the problem?

This is the first time I played with DesktopColorPicker and I did this:
1- add a property to the Window called my_colorpicker as DesktopColorPicker
2- open event for the Window: my_colorpicker = new DesktopColorPicker
3- one button with this code: my_colorpicker.Show(color.blue,"")
4- another button with this code:

if my_colorpicker.IsVisible Then
  my_colorpicker.close
end if

When I run the program and press Button2 the color picker is closed if it is visible.

https://docs.xojo.com/DesktopColorPicker

Shows them both as shared properties / methods. Compiler would disagree.

The problem with the run time errror is when you have a modal window open which has the desktopcolorpicker control added to it and you call the close method against it, and then close your modal window in the same method.
So do your same test just in a modal window using the first line of code i showed.

w.ShowModalWithin(parent)

If you can easily reproduce this, please create a bug report in feedback.

I can’t reproduce the problem, maybe (most likely) I’m missing something. Sorry.

I am using Xojo2021r1.1

I have not used the color picker in Xojo, but the version in strata 3D crashes it consistently “due to a known apple bug.” Any relevance?

feedback://showreport?report_id=64539

For ARM I get a NOE in

w.ShowModalWithin(self)

For Intel the app drops into the debugger. But it continues without problems.

I think this falls under “not a good idea”. macOS BS 11.2.1.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.