Page 1 of 1

Android crash in Hide after I added a toolbar

Posted: Fri Jul 11, 2025 11:33 pm
by whisper1980
I added a toolbar based entirely on your Editor2 demo. It works great on iOS, but crashes Android when I do a rve.Clear (even though your demo does not crash).

In fmxRVSelectionHandlesFM, procedure TRVFMXSelectionHandles.Hide, line 594 you have this:

Code: Select all

  if CaretPt <> nil then
    CaretPt.Visible := False;
The first time I go to load the TRichViewEdit, I invoke Clear, and the value of CaretPt is: $b400007b0f1108d0 (your demo has a value that is also not nil ($b400007b0f0d2970).

If I set it to nil using the debugger this one time, it continues just fine and does not crash, and I can continue to clear and load new content into the TRichViewEdit without fail. I must not be doing something after adding the toolbar, but I can't find what that might be.

Some other things: I also don't get that little balloon popup to move the caret precisely as in your demo. On iOS only, my app doesn't crash at all, but I can't place the caret in a word... it puts the caret at the start or end of the word I tap on.

Got any ideas?
Eric

Re: Android crash in Hide after I added a toolbar

Posted: Sat Jul 12, 2025 9:35 pm
by whisper1980
This is the stack trace when it crashes on CaretPt.Visible := False; where in this case, CaretPt is $b400007b0f110f40

Code: Select all

Fmxrvselectionhandlesfm.TRVFMXSelectionHandles.Hide()($b400007b9f257cf0)
Fmxrvselectionhandlesfm.TRVFMXSelectionHandles.SetPositions(bool)($b400007b9f257cf0,false)
Fmxrvrvdata.TRichViewRVData.UpdateSelectionHandles(bool, bool)($b400007c4f0983b0,false,false)
Fmxrvrvdata.TRichViewRVData.DoSelect()($b400007c4f0983b0)
Fmxrvervdata.TRVEditRVData.DoSelect()($b400007c4f0983b0)
Fmxcrvfdata.TCustomRVFormattedData.Deselect(Fmxrvitem.TCustomRVItemInfo*, bool)($b400007c4f0983b0,nil,true)
Fmxrvctrldata.TRVControlData.Deselect(Fmxrvitem.TCustomRVItemInfo*, bool)($b400007c4f0983b0,nil,true)
Fmxcrvfdata.TCustomRVFormattedData.Clear()($b400007c4f0983b0)
Fmxrvrvdata.TRichViewRVData.Clear()($b400007c4f0983b0)
Fmxrvervdata.TRVEditRVData.Clear()($b400007c4f0983b0)
Fmxrichview.TCustomRichView.Clear()($b400007acf0b6440)

Re: Android crash in Hide after I added a toolbar

Posted: Sun Jul 13, 2025 12:05 pm
by Sergey Tkachenko
It looks like this is a bug.
Open fmxRVSelectionHandlesFM.pas, and change procedure TRVFMXSelectionHandles.Clear to:

Code: Select all

procedure TRVFMXSelectionHandles.Clear;
begin
  FLeftSelPt  := nil;
  FRightSelPt := nil;
  FCaretPt := nil;
end;
Then recompile the packages (run "Install TRichView FMX in Delphi IDE" in Windows Start menu).

Re: Android crash in Hide after I added a toolbar

Posted: Sun Jul 13, 2025 8:29 pm
by whisper1980
Thanks! That seems to have fix it! I was about to revert everything, so I'm very thankful for a quick fix!