Bug 135528 - CRASH running a macro (that changes text) from IDE, when StylesInspector is running
Summary: CRASH running a macro (that changes text) from IDE, when StylesInspector is r...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.1.0.0.alpha0+ Master
Hardware: All All
: medium major
Assignee: Shivam Kumar Singh
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks: Styles_Inspector
  Show dependency treegraph
 
Reported: 2020-08-07 10:46 UTC by Mike Kaganski
Modified: 2020-08-12 10:11 UTC (History)
2 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 2020-08-07 10:46:07 UTC
Running this code when in IDE, and Styles Inspector is active in current text document, crashes LO:

Sub crashWithSI
  ThisComponent.CurrentController.ViewCursor.Start.setString("a")
End Sub

Version: 7.1.0.0.alpha0+ (x64)
Build ID: 52f8e0b6f09be0e8e8a068edef2017d45d5a1892
CPU threads: 12; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

See also bug 135178 comment 8, which might be related.
Comment 1 Roman Kuznetsov 2020-08-08 18:43:17 UTC
confirm crash in

Version: 7.1.0.0.alpha0+ (x64)
Build ID: <buildversion>
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Vulkan; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

build from 8 August 2020
Comment 2 Mike Kaganski 2020-08-11 10:28:35 UTC
A code pointer:

WriterInspectorTextPanel's AttrChangedNotify tries to get a "current" shell, which might change over time, while the panel should be bound to the original shell.

On the other hand, Writer's SI captures a SwWrtShell in its ctor, which is what may be used later everywhere when it needs any shell. E.g., the SwWrtShell is the shell that provides cursor itself; to get document shell from SwWrtShell, you call m_pShell->GetDoc()->GetDocShell().

HTH.
Comment 3 Commit Notification 2020-08-12 10:08:39 UTC
Shivam Kumar Singh committed a patch related to this issue.
It has been pushed to "master":

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

tdf#135528 tdf#135491 Fix LO crash when using macro with SI enabled

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.