Bug 144376 - Crash when triggering twice "Protected cells can not be modified" (reproducible)
Summary: Crash when triggering twice "Protected cells can not be modified" (reproducible)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.2.0.4 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.3.0 target:7.2.2 target:7.1.7
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-08 10:51 UTC by Victor V. Terber
Modified: 2021-09-09 11:31 UTC (History)
2 users (show)

See Also:
Crash report or crash signature: https://crashreport.libreoffice.org/stats/crash_details/351cf107-e18d-4fb2-84ae-588a774ef1c6
Regression By:


Attachments
Test file for bug 144376 (17.20 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-09-08 10:52 UTC, Victor V. Terber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Victor V. Terber 2021-09-08 10:51:47 UTC
Description:
LO calc crashes reproducibly when a protected cell is attempted to be changed using the mouse at the *second* attempt (not the first!)

Steps to Reproduce:
1. Open the attached document with LibreOffice 7.2.0.4 (x64)
2. Position cursor on cell A1
3. Mouse-click in the field where you usually enter formulas
4. Observe the correct message "Protected cells can not be modified."
5. Repeat step 3 (click with mouse use on formula entry)
6. LO crashes



Actual Results:
Crash

Expected Results:
No crash, just show the correct error message "Protected cells can not be modified."


Reproducible: Always


User Profile Reset: No



Additional Info:
No crash, just show "Protected cells can not be modified." instead
Comment 1 Victor V. Terber 2021-09-08 10:52:58 UTC
Created attachment 174886 [details]
Test file for bug 144376
Comment 2 Victor V. Terber 2021-09-08 10:57:11 UTC
Crash report shows EXCEPTION_ACCESS_VIOLATION_READ in EditEngine::GetText(LineEnd)
Comment 3 Mike Kaganski 2021-09-08 14:05:13 UTC
Repro using current master.

In ScInputHandler::InputChanged, the call to DataChanging frees the EditView that is passed in pView. Then pView is dereferenced.

Caolan: do you have an idea what to do here?
Comment 4 Caolán McNamara 2021-09-08 16:19:59 UTC
Certainly focus related, and it seems only on windows does that QueryCharPosition get sent on getting focus which falls into that command-handling case which seems to trigger the ScInputWindow into that path where it deletes the EditView. I think the expectation is that focus shouldn't be possible to put into it on the 2nd click.
Comment 5 Commit Notification 2021-09-09 10:42:50 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

Resolves: tdf#144376 focus into protected ScTextWnd shouldn't be possible

It will be available in 7.3.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 6 Caolán McNamara 2021-09-09 10:51:31 UTC
Works for me on trunk, backports in gerrit
Comment 7 Commit Notification 2021-09-09 11:29:57 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/76bb5cb8578bdfe50ce6bef307e628037d938a94

Resolves: tdf#144376 focus into protected ScTextWnd shouldn't be possible

It will be available in 7.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 8 Commit Notification 2021-09-09 11:31:10 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/65fb647b3b95ebc6023b6e02c5fc2a130842eac7

Resolves: tdf#144376 focus into protected ScTextWnd shouldn't be possible

It will be available in 7.1.7.

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.