Bug 132822 - Crash in undo in spell checking dialog when previous paragraph had undo information when the new paragraph replaced it
Summary: Crash in undo in spell checking dialog when previous paragraph had undo infor...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha0+
Hardware: All All
: high normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.1.0 target:7.0.0.1 target:6.4.6
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Crash
  Show dependency treegraph
 
Reported: 2020-05-07 15:42 UTC by Telesto
Modified: 2020-06-30 19:11 UTC (History)
2 users (show)

See Also:
Crash report or crash signature: ["ImpEditEngine::ImpDeleteSelection(EditSelection const &)"]


Attachments
Example file (13.81 KB, application/vnd.oasis.opendocument.text)
2020-05-07 15:42 UTC, Telesto
Details
Screencast (1.22 MB, video/mp4)
2020-05-22 11:03 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-05-07 15:42:38 UTC
Created attachment 160507 [details]
Example file

This bug was filed from the crash reporting server and is br-e1482066-f19d-4309-9c25-5a1bc818c11f.
=========================================

1. Open the attached file
2. Select the last line & Copy
3. Set cursor begin of the document
4. Open Spell checker (F7) 
5. Press Correct
6. Press Paste button in dialog)
7. Press Correct until Vestibulumu appears in red
8. Press Paste button (in dialog)
9. Press Undo button 3x? or maybe few times more
Comment 1 Xisco Faulí 2020-05-22 10:27:20 UTC
Which dictionary are you using?
Could you please also record a screencast?
Comment 2 Telesto 2020-05-22 11:03:42 UTC
Created attachment 161133 [details]
Screencast
Comment 3 Telesto 2020-05-22 11:04:10 UTC
English.. as the document setting shows
Comment 4 libre officer 2020-06-12 19:33:33 UTC
Another steps to reproduce:

1. Open Writer
2. Paste or type example text:

Lorem ipsum. Vestibulum

3. Copy phrase `Lorem lorem` from the text.
4. Set cursor begin of the document
5. Open Spell checker (F7).
6. Press `Correct` button.
7. Press `Paste` button in dialog.
8. Press `Correct` button.
9. Press `Correct` button.
10. Press `Paste` button in dialog.
11. Press `Undo` button in the dialog.
12. Press `Undo` button in the dialog.
13. Press `Undo` button in the dialog (wait a moment, this one will crash it)

I think the count of corrections is wrong, thus `undo` button is still activated.

Note: these texts don't cause any bug

text
Lorem ipsum Vestibulum
Comment 5 libre officer 2020-06-12 19:37:05 UTC
(continued)


Note: these texts don't cause any bug:

          text          |   pasted text
-----------------------------------------
Lorem ipsum Vestibulum  |  Lorem ipsum
Lorem ipsum. Vestibulum |  ipsum
Comment 6 libre officer 2020-06-12 19:39:46 UTC
This is the only bug report I got:
crashreport.libreoffice.org/stats/crash_details/2116c3a6-c021-49ea-98f7-453892b53f92


Version: 7.0.0.0.beta1 (x64)
Build ID: 94f789cbb33335b4a511c319542c7bdc31ff3b3c
CPU threads: 4; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win
Locale: fr-CH (fr_FR); UI: en-GB
Calc: threaded

Version: 6.4.3.2 (x64)
Build ID: 747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
CPU threads: 4; OS: Windows 10.0 Build 17763; UI render: default; VCL: win; 
Locale: fr-CH (fr_FR); UI-Language: en-US
Calc: threaded

Version: 6.4.1.2 (x86)
Build ID: 4d224e95b98b138af42a64d84056446d09082932
CPU threads: 4; OS: Windows 10.0 Build 17763; UI render: default; VCL: win; 
Locale: fr-CH (fr_FR); UI-Language: en-GB
Calc: CL
Comment 7 Telesto 2020-06-14 12:46:55 UTC
No crash with
Version: 6.0.0.0.alpha0+
Build ID: 2cd664b3d618e6085be8b44ee86eada6cd5f8789
CPU threads: 4; OS: Windows 6.29; UI render: default; 
Locale: nl-NL (nl_NL); Calc: CL
Comment 8 Xisco Faulí 2020-06-15 11:31:28 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=5261417cbb3051b812164838d19c0f748573df45

author	Caolán McNamara <caolanm@redhat.com>	2019-06-14 21:56:44 +0100
committer	Caolán McNamara <caolanm@redhat.com>	2019-06-21 21:33:30 +0200
commit 5261417cbb3051b812164838d19c0f748573df45 (patch)
tree d159cce1d6903854fc13437c5cca5ce15e48281f
parent fda464112540011dd6e2bd267720d2800af3a5f2 (diff)
weld SpellDialog

Bisected with: bibisect-linux64-6.4

Adding Cc: Caolán McNamara
Comment 9 Caolán McNamara 2020-06-15 14:28:44 UTC
Looks to me that before the change the undo would insert the previously replaced text of the last paragraph into semi-random locations in the current paragraph so it looks to me that it never worked right. I imagine that undo stack needs to be cleared when the dialog moves between paragraphs.
Comment 10 Caolán McNamara 2020-06-15 19:29:38 UTC
seems the dialog already tries to do that, but it doesn't work right because the undo stack has an open undo group at the time of the attempt to clear the undo stack so only the open group gets cleared so the undos remain on the stack
Comment 11 Commit Notification 2020-06-16 07:39:40 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7b137e5c7b25438cc56d988ca5dab099afbb31a5

tdf#132822 close open undo group before clearing undo stack

It will be available in 7.1.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 12 Commit Notification 2020-06-16 07:41:21 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/44041005186b0556a06695920de842c5998851f1

tdf#132822 close open undo group before clearing undo stack

It will be available in 7.0.0.1.

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 13 Caolán McNamara 2020-06-16 07:44:41 UTC
seems to work now for me, fixed in master and 7-0, backport to 6-4 in gerrit
Comment 14 Commit Notification 2020-06-30 19:11:01 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/7a542a41f48c673478606cba307662780e5137e0

tdf#132822 close open undo group before clearing undo stack

It will be available in 6.4.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.