Need technical support

I am at a loss with a crash happening when the app quits.

Since it is not a bug in Xojo, I don’t know how to request technical support. Should I go through Feedback ?

I will appreciate any idea.

Here is the crash report:

crash.zip

Any idea how you get that?

This may be a view getting redrawn after it was destroyed.
Like if your window got closed while there were still pending redraw events.

I am going to try and see if indeed some paint events don’t happen after I issue quit.

Thank you Christian.

On a hint from Norman, it could also be a CallLater or other timer that fires during app closedown referencing an object that has already closed.

I use several timers indeed. I shall check that as well. Thank you Jay.

This following code will force the application to terminate without winding down objects, I use it in the cancelClose event of the App object (after everything has been saved), it should also work from the close event.

#if targetMacOS then
  // --- Application termination code, will kill the application without winding down the objects first.
  //     Extracted from the Ohanaware App Kit by Sam Rowlands, April the 10th 2022.
  //     This methodology is actually preferred by Apple, i.e. some OS services won't work
  //     if the windows and application are wound down.
  //     When sharing this code, please retain this header, function names and function comments
  //     to help others in the future if they need to refer to documentation on the API.
  
  // --- Uncomment the following section if you are profiling the application.
  // #if debugBuild then
  // return
  // #endif
  
  declare function NSClassFromString               Lib "Foundation" ( className as CFStringRef ) As integer                                       // OSX 10 + 
  declare sub      NSApplication_terminate         lib "Foundation" selector "terminate:" ( NSApplicationInstance as integer, sender as integer ) // OSX 10 + 
  declare function NSApplication_sharedApplication lib "Foundation" selector "sharedApplication" ( NSApplicationClass as integer ) as integer     // OSX 10 + 
  
  Dim applicationInstance as integer = NSApplication_sharedApplication( NSClassFromString( "NSApplication" ) )
  NSApplication_terminate applicationInstance, applicationInstance
  
#endif
2 Likes

Thank you Sam.

I placed that in CancelClose, but no joy. The gremlin is still acting up :confused:

1 Like

I added a small method to close all timers in a window, which I use in every cancelclose:

Public Sub StopTimers(w as window)
  
  for i as integer = 0 to w.ControlCount-1
    if w.Control(i) isa timer then
      timer(w.Control(i)).RunMode = Timer.RunModes.Off
    elseif w.Control(i) isa Thread then
      thread(w.Control(i)).Stop
    end if
  next i
End Sub

Additionally, I return from every paint event handler when the application quits.

Problem is, I still get the very same error. I really don’t see what could be causing the exception mentioned.

I will appreciate it very much if someone who knows better how to decipher the described exception in the crash report gives me a hint where to look.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               Check Writer III+.debug [12833]
Path:                  /Users/USER/Documents/*/Check Writer III+.debug.app/Contents/MacOS/Check Writer III+.debug
Identifier:            Check Writer III+.debug
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2022-04-20 09:47:01.5066 +0200
OS Version:            macOS 12.3.1 (21E258)
Report Version:        12
Anonymous UUID:        31CA760B-7915-9E9A-4E57-B3772296FAD4


Time Awake Since Boot: 3800 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BREAKPOINT (SIGTRAP)
Exception Codes:       0x0000000000000001, 0x00000001907ee2e8
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
Terminating Process:   exc handler [12833]

Application Specific Information:
Over-release of NSResponder or subclass.



This one looks different to your first report. Do you have a full crash report too?
Do you use any declares or maybe old fixes that might cause an over-release? I remember closing a window on macOS did not release it in former IDE versions but have not checked if this is still the case. Any place where a Foundation.release is called?

When did this crash start occurring? Do you have a record of everything that changed in your code (or Xojo version?) since the last time it worked correctly?

Also, I assume it crashes on other computers, not just yours, right?

^ Seems a kind of releasing things already released.

1 Like

I found the gremlin!

I avoid implicit instances, and recently added a new window. I added a property to the main window which I used to store a new window.

What happened was indeed that somehow the main window close happened at a time when the new window was still around.

I have moved the property to a module, and the crash no longer happens :slight_smile:

Thank you for all the suggestions.

5 Likes