Bug 99975 - Problem Concerning Undo Manager
Summary: Problem Concerning Undo Manager
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Undo-Redo
  Show dependency treegraph
 
Reported: 2016-05-20 21:57 UTC by Stang
Modified: 2023-05-06 16:15 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Problem Sample (9.66 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-05-20 21:57 UTC, Stang
Details
bt with symbols (8.29 KB, text/plain)
2016-05-21 19:33 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stang 2016-05-20 21:57:10 UTC
Created attachment 125198 [details]
Problem Sample

Problem Concerning Undo Manager

Problem originally found on:

Version: 5.1.3.2
Build ID: 644e4637d1d8544fd9f56425bd6cec110e49301b
CPU Threads: 4; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8)

Also tested with the following on the same system:

v4.4.7.2
v5.0.6.3
v5.2.0.0 alpha 05/19/2016

All packages were X86_64 deb


Sheet Annotations insert & removeByIndex(x) is changing Undo isLocked from True to False & it cannot be set back to TRUE unless the document is closed & re-opened.

Using sheet Annotations:

1. Undo manager is set to .lock()
2. Call to insert new sheet annotation
3. no Undo is set for the inserted item – this is expected
4. checked .isLocked()   -  now set to FALSE – should not be
5. Next call to insert new sheet annotation
6. Undo is set for the inserted item – this is not what is wanted
7. If Undo manager is set to .lock() at this point, .isLocked remains at FALSE
To reset you must close the document & re-open

Using the same scenario as above, if Undo is set to .unlock() before the insert, it can be set to .lock() after the insert.

.clear() wipes all Undo’s.  No way to wipe just the last undo, otherwise this would be a workaround.

Almost the same holds true for .removeByIndex(x).  Can set lock after first remove but is frozen after that.  See tests below.

Using .setString(sSomeText) from cell annotation on an existing annotation, has no affect on Undo manager but you cannot insert or remove an annotation from the cell object.

Need this to keep Undo preserved prior to macro which can insert/delete hundreds (and potentially thousands) of items, thus wiping out any previous undo data.  Having no problem with other operations such as inserting/deleting rectangles.  Also, I am using annotations so I can quickly locate the affected cells.

The attached sample demonstrates the problem.  Toolbar (Annotation Bug) provided for macro execution.

Insert – Test 1
This macro inserts comments in A1:A4.  Before each insert, Undo is set to unlock and after each insert Undo is set to lock.  Shows Undo can be locked after an annotation insert if it is NOT locked before the insert.  Undo is set to unlock at the end of the macro.

Insert – Test 2
This macro inserts comments in A1:A4.  Before the FIRST insert, Undo is set to lock and after each insert Undo is again set to lock.  Shows Undo CANNOT be locked after an annotation is inserted if it IS locked before the insert.  Undo is set to unlock at the end of the macro.

Running Insert #1 after Insert #2 or Remove #2 will show all FALSE results.  Only way to reset is close document & re-open.



Remove – Test 1
Run Insert – Test 1 first to set comments. This macro removes comments in A1:A4.  Before each remove, Undo is set to unlock and after each remove Undo is set to lock.  Shows Undo can be locked after an annotation is removed if it is NOT locked before the removal.  Undo is set to unlock at the end of the macro.

Remove – Test 2
Run Insert – Test 1 first to set comments. This macro removes comments in A1:A4.  Before the FIRST remove, Undo is set to lock and after each remove Undo is again set to lock.  CAN set lock after first remove but frozen after that. Shows Undo CANNOT be locked after an annotation is removed if it IS locked before the removal.  Undo is set to unlock at the end of the macro.

Running Remove #1 after Insert #2 or Remove #2 will show all FALSE results.  Only way to reset is close document & re-open.

Manually inserting/deleting comments seems to have no affect on the Undo flag.
Comment 1 Stang 2016-05-21 03:31:18 UTC
I just discovered something that may narrow down the problem.  If you issue a oUndoManager.unlock() when islocked is already FALSE, you will get an error.  If you issue a oUndoManager.lock() when isLocked is already TRUE, you get NO error and the problem begins immediately.

This indicates there may be two problems.
  1) the ability to set lock when it is already set (unlike unlock)
  2) the possibility in Annotations .lock & .unlock are being used within
Comment 2 Julien Nabet 2016-05-21 19:33:44 UTC
Created attachment 125218 [details]
bt with symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.
I attached a bt which may help to have a starting code pointer.
Comment 3 Julien Nabet 2016-05-22 21:20:26 UTC
I submitted a patch for master sources (future 5.2.0) to review here:
https://gerrit.libreoffice.org/#/c/25325/
I'm not sure it's ok but the behavior seemed to me better with it.
Comment 4 Julien Nabet 2016-05-27 05:08:27 UTC
The patch seems wrong so I abandonned it.
Certainly someone else will help here.
Comment 5 Stang 2016-06-20 18:29:04 UTC
Taking a different approach in my project, I discovered this problem also occurs when changing 'UserDefinedAttributes' in a Cell.  Again, if not unlocked before changing the attributes, Undo Manager will remain unlocked until the document is closed and re-opened.  It is exactly the same scenario as Annotations.
Comment 6 QA Administrators 2017-09-01 11:17:52 UTC Comment hidden (obsolete)
Comment 7 Stang 2017-09-01 20:13:11 UTC
Just retested using v5.4.1.2 on Linux Mint18.2 and problem is still present.
Comment 8 Stang 2017-12-24 20:03:18 UTC
This bug is still present in Beta of:

Version: 6.0.0.1
Build ID: d2bec56d7865f05a1003dc88449f2b0fdd85309a
CPU threads: 4; OS: Linux 4.8; UI render: default; VCL: gtk2; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 9 QA Administrators 2018-12-25 03:39:07 UTC Comment hidden (obsolete)
Comment 10 QA Administrators 2020-12-25 03:53:19 UTC Comment hidden (obsolete)
Comment 11 QA Administrators 2022-12-26 03:17:24 UTC
Dear Stang,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug