Bug 116789 - UNO API: XText of cell is not the same object all the time
Summary: UNO API: XText of cell is not the same object all the time
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:6.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-04 08:52 UTC by Miklos Vajna
Modified: 2018-04-05 07:29 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Python-only reproducer for bibisect purposes. (2.15 KB, text/plain)
2018-04-04 08:52 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Vajna 2018-04-04 08:52:55 UTC
Created attachment 141073 [details]
Python-only reproducer for bibisect purposes.

Steps to reproduce:

1) Apply the attached python patch, so you have a python script that can register a selection listener.
2) Create a writer document and run the python script.
3) Type some characters, create a bookmark covering some of the characters in the document and move around with your cursor: you can see on the console that XText from the selection and from the bookmark is the same SwXBodyText, same pointer address.
4) Now insert a table and do the same (insert characters, insert bookmark) in a table cell.

Expected result: similar to outside a table, the XText is the same SwXCell in both the selection and the cell case.

Actual result: we hand out two separate SwXCell instances (different pointer address).

This is problematic, as later XTextRangeCompare will require that the text ranges come from the same XText, so you can't compare ranges from in-table text.
Comment 1 Commit Notification 2018-04-04 16:53:59 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b9f7535e499002706f276c0275c1e6c3c7b6bdd4

tdf#116789 sw: fix caching of the SwXCell UNO wrapper

It will be available in 6.1.0.

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

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