Problem with the RichEdit components on OSx

I am experiencing a lot of trouble with the RichEdit components (both FNC and FMX) on the OSx 64 platform.

I am developing 4 Applications for the Win64 and OSx64 platform and all of them have an ‘editor’ Form which contains a RichEditor, a (Dock) Panel, an EditToolbar and a FormatToolbar.
The Form is created on demand with “Form_Editor:= TForm_Editor.Create(self);”

On the Win64 platform there are no problems but on the OSx64 platform I am getting completely random RangeCheck (FMX) or Integer Overflow (FNC) errors while creating the Form.

The strange thing is that if one Application fails to create the Form ALL of the Applications fail to create the Form. And when for example an hour later one Application succeed in the Form creation ALL of the Applications succeed. I can’t find out what’s the trigger why the Form creation succeeds or fails.

What I DID find out is that when I DON’T attach the EditToolbar to the RichEditor in designtime the Form creation ALWAYS succeeds.

Attaching the EditToolbar to the RichEditor in runtime in for example the Forms OnShow or OnActivate through “ TMSFNCRichEditorEditToolbar.RichEditor:= TMSFNCRichEditor; “ again results randomly in the RangeCheck or Inter Overflow errors.

Does anyone have any idea why this happens and how to fix this???
Best regards
Anske

There is a more strict range checking in Delphi 11, so you can turn this off with {$RANGECHECKS OFF} in your application. We'll investigate here why there is a range check error.

I turned of Range Checking through {$R-} and {$O-} just before the formcreation but that doesn't seem to work under OSx

Is it possible to send some kind of a reproducible sample?

Your TMS FNC UIPack FMX RichEditor demo application shows the same behavioure when compiled and run in OSx 64. Because the Edittoolbar in the demo app is on the main form the application doesn't open at all.
The most wierd thing is that it not always happens. It's always a gamble if the app opens or not.
Does it open then the editor in my apps also open, if not then the editor in my apps also don't open.

We'll investigate

We have tested this here multiple times and are not able to reproduce this issue unfortunately. Did you try running the application in release mode and see if that makes a difference?

Unfortunally this makes no difference. And it's not only me but at least 2 of my customers are experiencing the same problem. Like I said earlier, the wierd thing ist that it doesn't happen all the time. Right now I can't start the demo app. Good change that when I try later this afternoon there are no problems.

can you run "Console" application on the mac and monitor what happens (errors, warnings), when starting the application?

Yes I can, but I will report to you later because right now there are no problems, where 24 minutes ago the app wouldn't start at all while nothing on the app itself changed

Exception ERangeError in module Demo at 00000001095686C6.
Range check error.
objc[11839]: objc_disposeClassPair: class 'FMXWindow' still has subclasses, including 'NSKVONotifying_FMXWindow'!
objc[11839]: objc_disposeClassPair: class 'FMXWindow' still has subclasses, including 'NSKVONotifying_FMXWindow'!

The FMXWindow errors are most likely not related to the range checking errors. Typically a range checking error will occur in debug circumstances as well, showing the code that is throwing the range check error. Could you run in debug mode and see if it breaks? If so, please add {$RANGECHECKS OFF} in that specific unit, at the top

Unfortunally {$RANGECHECKS OFF} doesn't work at all. I found out that the problem is with the TMSFMXRichEditToolBar. When I don't put this component on the form there are no problems at all.
The next thing I tried is put it on the form but tie it to the richeditor component in runtime in the onactivate event. The result of that is that the editor form opens now without errors, but now I'm getting the rangecheck error while typing. My 'solution' for now is to create this EditToolBar dynamic in the form.onactive event and when an error occurs it wil be freed.
As for now this seems to work, but like I earlier said the problem doesn't occur all the time. We (me and my customers) have day's with no problems at all and then suddenly a day that nothing seems to work.
As far as I can tell, this happens only when the app is compiled and running under OSx.

If you debug in RAD Studio, and get the range check error, if you press break, does it break in a specific unit? If so, can you please tell us which unit this is. Most likely, it's a conversion routine Integer to Single/Double or something else that is causing issues. In Delphi 11, the range checking is more strict.

That's hard to say, most of the time I don't have the problem but my customers do have.
All I know is that it only happens running the app in OSx and IF the problem occurs on MYcomputer it also happens in YOUR RichEditor demo app.

Hi,

We traced and solved the range check error in the demo. Thanks for reporting. Next version will address this.

Thank you, are you planning to correct this also in the FMXRicheditor? This one has the same problem and I have to use the FMXRicheditor because the FNCRicheditor doesn't have a spellchecker

Should automatically be fixed.

OKay

Unfortunately the problem isn’t solved, at least in the TMSFMXRichedit (MacOS), even worse it occasionally creates am AppCrash now.
I have to use the tmsFMXricheditor because the tmsFNCricheditor doesn’t have a spellchecker (yet?)
I also have to use Delphi 11.2 because one of the other components sets I use (a report builder) has a problem with Delhi 11.3

For now I am ‘bypassing’ the problem this way:

procedure TForm_Editor.FormActivate(Sender: TObject);
begin
TMSFMXBarButton_Save.Visible := dmData.ByPass;
TMSFMXRichEditorEditToolBar.Visible := not dmData.ByPass;
if not dmData.ByPass then TMSFMXRichEditorEditToolbar.RichEditor:= TMSFMXRichEditor;
End;

dmData.ByPass is a boolean value set by a checkbox in the settings form of my app