[Lazarus] Modal Window Crashes on Mac OS X 10.15 Beta (Catalina)
Dmitry Boyarintsev
skalogryz.lists at gmail.com
Tue Jun 11 16:19:35 CEST 2019
On Tue, Jun 11, 2019 at 10:06 AM David Jenkins via lazarus <
lazarus at lists.lazarus-ide.org> wrote:
> I looked at the assembly for NSApplication.run, there are a lot of things
> being called and set before the call to nextEventMatching... The
> .isRunning variable being one of them - which is read only and can't be
> set. It can be overridden (and is one of the suggested overrides) but
> unfortunately there are times, in other parts of the code, that they look
> directly at the ._running variable where the value of .isRunning is stored
> instead of calling .isRunning (look at NSApplication._setMainWindow).
> Which sets up a mismatch between what an overridden .isRunning method would
> return and what ._running is set to.
>
Let's back-up a little bit.
Can we actually try to set the value for the instance variable?
1) it's absolutely legal in Objective-C terms (object_getInstanceVariable,
object_setInstanceVariable).
2) its' absolutely legal in KVC term. (I can presume that KVC is pretty
much based on top of objc-run time. And this is how the entire Swift<->ObjC
binding works)
Can anyone try and modify TCocoaApplication.run to look like this. (If
you're using trunk, you'll need to have {$define COCOALOOPOVERRIDE} defines
in cocoadefines.inc}
procedure TCocoaApplication.run;
begin
self.setValue_forKey(NSNumber.numberWithBool(true),NSSTR('_running')); //
setting instance variable through KVC
isrun:=true;
aloop();
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190611/bab3e1f7/attachment.html>
More information about the lazarus
mailing list