Bug 160138 - Basic code for Writer can't select the anchor of a TextField object using the CurrentController
Summary: Basic code for Writer can't select the anchor of a TextField object using the...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.6.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.8.0 target:24.2.2 target:7.6.7
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
 
Reported: 2024-03-10 17:28 UTC by Wolfgang Jäger
Modified: 2024-03-26 11:02 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
The attachment announced in the report (30.96 KB, application/vnd.oasis.opendocument.text)
2024-03-10 17:28 UTC, Wolfgang Jäger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Jäger 2024-03-10 17:28:10 UTC
Created attachment 193046 [details]
The attachment announced in the report

In Writer a coimmand
ThisComponent.CurrentController.select(myTextFiled.Anchor) 
is simply ignored.
The effects are demonstrated in the attached example.
The bug is new. It never occured with versions 3.3 through 7.5 (and also not in AOO 4.1.7).
Comment 1 Stéphane Guillou (stragu) 2024-03-26 08:55:09 UTC
No reproduced in 7.5.9, the macro selects the text runs.

Bug reproduced in:

Version: 7.6.5.2 (X86_64) / LibreOffice Community
Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Bibisected with linux-64-7.6 repository to first bad build [7b68f3b055c3998e14bfe0df46ee0051e960b18a] which points to:

commit 635448a996714a81cb15b41ac4bb0c73cabfb74f
author	Noel Grandin 	Wed Jan 18 15:49:41 2023 +0200
committer	Noel Grandin 	Fri Jan 20 08:20:20 2023 +0000
XUnoTunnel->dynamic_cast in SwXTextRange
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145857

But works again in:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 1344e6261a1d856c71eca1e0cc29215a586bf335
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

linux-64-24.8 repo does not have the fix currently, so it must be something in the last 12 days: 
https://git.libreoffice.org/core/+log/2887ffbf240aa70330cb50bf810170cf9c896405..1344e6261a1d856c71eca1e0cc29215a586bf335

Maybe Noel has an idea.
Comment 2 Noel Grandin 2024-03-26 09:20:21 UTC
(In reply to Stéphane Guillou (stragu) from comment #1)
> Maybe Noel has an idea.

Sorry, no idea
Comment 3 Stéphane Guillou (stragu) 2024-03-26 11:02:03 UTC
Bibisected the fix to:

commit 8f2de92b3da99346f7282e623d47912f40f92b7b
author	Michael Stahl 	Fri Mar 22 12:28:43 2024 +0100
committer	Michael Stahl 	Fri Mar 22 15:15:06 2024 +0100
sw: GetSelectableFromAny() broken for SwXTextRange
The function unnecessarily uses an intermediate XUnoTunnel variable to
handle SwXTextRange, but the implementation of XUnoTunnel was removed.
(regression from commit 635448a996714a81cb15b41ac4bb0c73cabfb74f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165162

(I need to remember to grep the offending commit in case it's mentioned)

It has been cherrypicked to 24.2 and 7.6.

Thank Michael for the fix!