Bug 155951

Summary: crash with XTextRange::getString()
Product: LibreOffice Reporter: László Németh <nemeth>
Component: sdkAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: nemeth
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: target:24.2.0 target:7.6.0.0.beta2
Crash report or crash signature: Regression By:

Description László Németh 2023-06-20 16:59:48 UTC
Description:
XTextRange::getString() triggers selection change event, resulting infinite recursion using it in selectionChanged().

Steps to Reproduce:
Add a XSelectionChangeListener to the document with a selectionChanged() calling the getString() of the selected text range. Select a word in the document editor using the Ctrl-Shift-arrow keys.

Actual Results:
LibreOffice crashes because of the infinite recursion.

Expected Results:
No crashing.


Reproducible: Always


User Profile Reset: No

Additional Info:
See Bug 154521 for a pyUNO test code.
Comment 1 Commit Notification 2023-06-21 07:53:25 UTC
László Németh committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/993e420e3b89193b14c8289abcaecca9a90fc42f

tdf#155951 sw: fix crash using XTextRange::getString() in selectionChanged()

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 2 Commit Notification 2023-06-21 08:55:36 UTC
László Németh committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/440179cfce5aafa7f480bfea48984451553f8e84

tdf#155951 sw: fix crash using XTextRange::getString() in selectionChanged()

It will be available in 7.6.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.