Author Topic: Mac: LCL crash and burn in cocoaint.pas  (Read 317 times)


  • Newbie
  • Posts: 2
Mac: LCL crash and burn in cocoaint.pas
« on: February 04, 2023, 09:15:22 pm »
   I am compiling a rather complicated app from source code that is not written by me. According to the author, the code works fine on Win and Linux. Unfortunately, I am not a Pascal programmer, so I'm rather lost as to how to find the source of the error. Any help would be appreciated so that I can fix this bug.

Running the compiled app in the Lazarus debugger on my Mac (running Ventura), I get a popup error immediately before any window is rendered. See attached popup.

The break is at line 375. The image when expanded in the debugger at that line is attached. called line 375 and Self is actually NIL. See attached image.

So, something is calling Perform() that shouldn't. How do I go about finding who is calling this so that a NIL check can be added?

Note: If I run this program *outside* the debugger in Ventura, this app works fine. No popup at all! However, the same app run in Monterey and Mojave immediately dies without the popup or any screen rendering. My suspicion is that this *is* a bug that Ventura doesn't see outside of the debugger.

Thanks for any pointers.


« Last Edit: February 05, 2023, 03:09:33 pm by cytan299 »


  • Newbie
  • Posts: 2
Re: Mac: LCL calling unallocated window
« Reply #1 on: February 05, 2023, 01:48:52 am »
Hi everyone,
   I have traced the problem to one possibility: the eventExpDate is blank in the argument of:

event := NSApp.nextEventMatchingMask_untilDate_inMode_dequeue(NSAnyEventMask, eventExpDate, NSDefaultRunLoopMode, true);

which lives in See attached screen capture. Is this variable supposed to be blank?

   The previous call to TCocaWidgetSet.AppRunMessages() is in

                      WidgetSet.AppProcessMessages; // process all events

and doesn't have any arguments.

The next call is in cocoaint.pas:

Result:=inherited nextEventMatchingMask_untilDate_inMode_dequeue(mask,
    expiration, mode, deqFlag);

"expiration" is also blank because it came from "eventExpDate".

Once I step into the above, I immediately get the popup error I posted earlier.

So, if this is the problem, how do I fix it?

« Last Edit: February 05, 2023, 01:53:43 am by cytan299 »


TinyPortal © 2005-2018