Bug 135457 - CRASH in a BASIC macro
Summary: CRASH in a BASIC macro
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:7.1.0 target:7.0.2 target:6.4.7
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2020-08-05 09:56 UTC by Mike Kaganski
Modified: 2020-08-23 15:15 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Some fields to convert to text by macro (deleted)
2020-08-05 09:56 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2020-08-05 09:56:54 UTC
Created attachment 163960 [details]
Some fields to convert to text by macro

When the following BASIC code is executed on the attached document, LibreOffice crashes:

Sub FieldsToText
  fields = ThisComponent.getTextFields.CreateEnumeration
  Dim map()
  While fields.hasMoreElements
    field = fields.nextElement
    ReDim Preserve map(LBound(map) To UBound(map) + 1)
    map(UBound(map)) = Array(field, field.getPresentation(false))
  Wend
  For i = LBound(map) To UBound(map)
    a = map(i)(0).getAnchor
    If Not (a Is Nothing) Then
      map(i)(0).getAnchor.setString(map(i)(1))
    End If
  Next i
End Sub

Tested with Version: 7.1.0.0.alpha0+ (x64)
Build ID: ed3ccdbde9ace7d2e3d67a9cc83a189cfaf1cad9
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

The crash seems related to undo data.
Comment 1 Xisco Faulí 2020-08-05 09:59:01 UTC
Reproduced in

Version: 7.1.0.0.alpha0+
Build ID: 58937aa4a50ecd681382f03331340da4c843b01e
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 2 Xisco Faulí 2020-08-05 10:06:07 UTC
Doesn't crash for me in

Version: 5.3.0.0.alpha1+
Build ID: 4136757b4e51c4e6f7cb4132c95538a7f831ef2c
CPU Threads: 4; OS Version: Linux 4.19; UI Render: default; VCL: gtk3; Layout Engine: new; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 3 Xisco Faulí 2020-08-05 10:24:45 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=91b2325808a75174f284c48c8b8afc118fad74e4

author	Michael Stahl <Michael.Stahl@cib.de>	2019-12-05 16:49:33 +0100
committer	Michael Stahl <michael.stahl@cib.de>	2019-12-06 13:26:32 +0100
commit 91b2325808a75174f284c48c8b8afc118fad74e4 (patch)
tree d456e57e6d0d0532592030cb0d3d20585b8fe7a4
parent 6ed12ab2d0742f86ce25defec3c776562dbfad9a (diff)
tdf#121300 sw: consistent fly at-pargraph selection

Bisected with: bibisect-linux64-7.0

Adding Cc: to Michael Stahl
Comment 4 Xisco Faulí 2020-08-05 11:34:14 UTC
The content of attachment 163960 [details] has been deleted for the following reason:

user's request
Comment 5 Commit Notification 2020-08-14 17:40:47 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/14fd4b54113f884cfd6871aeff693734fc06224b

tdf#135457 sw: fix invalidation of SwXTextField

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 6 Commit Notification 2020-08-17 08:37:31 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/27e9ead64d4e3a3f3b3d1203f7b9fee50eb0d04d

tdf#135457 sw: fix invalidation of SwXTextField

It will be available in 7.0.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 7 Michael Stahl (allotropia) 2020-08-19 11:10:45 UTC
actually regression presumably from:

commit e18359445fabad9ba1a704600e9ee327112cc6ae
Author:     Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
AuthorDate: Sun Apr 14 13:33:35 2019 +0200
Commit:     Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
CommitDate: Sun May 5 22:27:54 2019 +0200

    [API CHANGE] SwXTextField: no more SwModify/SwClient
    
    - fix unittest assuming the double-insertion of annotation
      throwing an IllegalArgumentException was intentional
    - remove SwModify/SwClient in SwXTextField
    - also: add basic C++ api test


... which is older than the commit in comment #3 ?

fixed on master
Comment 8 Commit Notification 2020-08-21 10:56:17 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/8f563f83a1cad52ba397fd7386690736fb891db6

tdf#135457 sw: fix invalidation of SwXTextField

It will be available in 6.4.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.
Comment 9 Mike Kaganski 2020-08-23 15:15:51 UTC
Thank you Michael!