Bug 159813 - Assertion failed when dragging-and-dropping text
Summary: Assertion failed when dragging-and-dropping text
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.8.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.8.0 target:24.2.2 target:7.6.6
Keywords:
Depends on:
Blocks: Crash-Assert
  Show dependency treegraph
 
Reported: 2024-02-21 07:19 UTC by Mike Kaganski
Modified: 2024-02-22 10:19 UTC (History)
3 users (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 Mike Kaganski 2024-02-21 07:19:05 UTC
1. Create a new text document.
2. Press [Enter] to add a second paragraph.
3. Ctrl+A - select all.
4. Using mouse, drag the selection to the very end of the document.

=> In debug builds, an assertion is failed, at start of DocumentContentOperationsManager::CopyFlyInFlyImpl [1], because pCopiedPaM->End()->GetNode() returns node 11, while rRg.aEnd.GetNode() gives node 10.

The assertion appeared in commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5 (tdf#117185 tdf#110442 sw: bring harmony & peace to fly at-char selection, 2019-07-22).

The difference of the nodes is caused by the code in DocumentContentOperationsManager::CopyWithFlyInFly, which restores rRg.aEnd in 'if (bEndIsEqualEndPos)' condition, after nodes were inserted, which shifted both pCopiedPaM and rRg.aEnd.

I am not sure, if the assertion is not correct, or if there really is a (pre-existing) bug here?

[1] https://opengrok.libreoffice.org/xref/core/sw/source/core/doc/DocumentContentOperationsManager.cxx?r=9bb7d239#3954
Comment 1 Commit Notification 2024-02-21 13:55:50 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bf269ed81fe2ec7c89a0f7d2d22e8e1982f558f4

tdf#159813, tdf#159816: Use correct copied PaM

It will be available in 24.8.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 2024-02-21 20:16:44 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/344c18c8e54a4382f7b990b58ed4c083d0568f74

tdf#159813, tdf#159816: Use correct copied PaM

It will be available in 24.2.2.

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 3 Stéphane Guillou (stragu) 2024-02-22 00:24:40 UTC
repro in debug build:

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

Thanks Mike!
Comment 4 Commit Notification 2024-02-22 10:19:10 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/d71c92ffe97c11e8a575cca38e36ef6916c4a3cc

tdf#159813, tdf#159816: Use correct copied PaM

It will be available in 7.6.6.

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.