Lazarus

Programming => LCL => Topic started by: cytan299 on February 04, 2023, 09:15:22 pm

Title: Mac: LCL crash and burn in cocoaint.pas
Post by: cytan299 on February 04, 2023, 09:15:22 pm
Hi,
   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 rasterimage.inc line 375. The image when expanded in the debugger at that line is attached.

control.inc 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.

cytan





Title: Re: Mac: LCL calling unallocated window
Post by: cytan299 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 application.inc. See attached screen capture. Is this variable supposed to be blank?

   The previous call to TCocaWidgetSet.AppRunMessages() is in applications.inc:

                      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?

cytan
TinyPortal © 2005-2018