Bug 155951 - crash with XTextRange::getString()
Summary: crash with XTextRange::getString()
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:7.6.0.0.beta2
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-20 16:59 UTC by László Németh
Modified: 2023-06-21 08:55 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.