Bug 152619 - Basic, Writer: Trying to inspect a just created not yet inserted instance of textfield.DateTime in the IDE causes a crash.
Summary: Basic, Writer: Trying to inspect a just created not yet inserted instance of ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.3.0.4 release
Hardware: All All
: high critical
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.6.0 target:7.5.3.2 target:7.4.7
Keywords: bibisected, bisected, haveBacktrace, regression
Depends on:
Blocks: Crash
  Show dependency treegraph
 
Reported: 2022-12-20 14:11 UTC by Wolfgang Jäger
Modified: 2023-05-03 10:18 UTC (History)
4 users (show)

See Also:
Crash report or crash signature: ["SwDoc::getIDocumentStylePoolAccess()"]


Attachments
GDB trace of crash (20.89 KB, text/plain)
2023-03-23 11:15 UTC, Buovjaga
Details
Example file with macro (9.64 KB, application/vnd.oasis.opendocument.text)
2023-03-23 11:15 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Jäger 2022-12-20 14:11:20 UTC
New TextDocument, new Basic module

Sub testThis()
 dtField = ThisComponent.createInstance("com.sun.star.text.textfield.DateTime")
 REM No error
 REM Try to inspect the new instance: Full crash.
End Sub

The baby DateTime field inserted into the text -even if not additionally initialized- accepts inspection without the crash. 

It is a regression. Up to V 5.4.4 I didn't get the crash.
Versions 6.4.5 and higher (including 7.5.0.0.beta1) showed the bug.
Comment 1 Buovjaga 2023-03-15 13:23:40 UTC
(In reply to Wolfgang Jäger from comment #0)
>  REM Try to inspect the new instance: Full crash.

What does this mean? Please explain what we have to do.

Set to NEEDINFO.
Change back to UNCONFIRMED after you have provided the information.
Comment 2 Wolfgang Jäger 2023-03-19 13:43:50 UTC
Create a new TextDocument (you may leave the text empty).
Just to keep testing separate from different macros:
Create a new Basic module in the Standard library of the new Document.
(The issue also occurs if the code is executed from a module in the application's library.)

Insert the above given 5 lines of Basic code (2 of them REM) into the module.

Execute as a step (F8) in the IDE the first actual statement beginning with
"dtField = ..."
Do NOT execute a second step! (Would exit the Sub in this case.

REM While the Sub is still running: Statement-position-arrow visible and pointing to 'End Sub'.

Enter the variable name "dtField" into the 'Watch' bar. It's shown in the panel now.

REM Still not having exited the Sub:
Click on the little "+" next to 'dtField' in the Watch panel.

Enjoy the crash. 

I originally did not test with different subtype services of
"com.sun.star.text.textfield..."
Assuming I would get the same result, I didn't want to get crashs again and again, and to probably get a corrupted configuration once.
Now I also tested with subtype ".Author" and got the same kind of total crash.

As soon as the field is already INSERTED into a text object by a statement like
tx.insertTextContent(someRange, theField, anyBoolean)
It can be inspected without a crash.
Comment 3 QA Administrators 2023-03-20 03:27:11 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2023-03-22 15:45:45 UTC
(In reply to Wolfgang Jäger from comment #2)
> REM While the Sub is still running: Statement-position-arrow visible and
> pointing to 'End Sub'.

I don't understand what this means.
Comment 5 Wolfgang Jäger 2023-03-23 10:56:28 UTC
(In reply to Buovjaga from comment #4)
> (In reply to Wolfgang Jäger from comment #2)
> > REM While the Sub is still running: Statement-position-arrow visible and
> > pointing to 'End Sub'.
> 
> I don't understand what this means.

There was given a short Sub intended to run for a text document in LibO:
Sub testThis()
 dtField = ThisComponent.createInstance("com.sun.star.text.textfield.DateTime")
 REM No error
 REM Try to inspect the new instance: Full crash.
End Sub

Execute the single statement as a step (F8 or respective Click) in the IDE.
The little arrow left of the line numbers pointing to the statement to be executed next now points to 'End Sub'.
This indicates that the Sub not yet was exited.
The objects shown in the Watch panel are still "living", and the object dtField listed there (in the only used line likely) has a little framed "+" in front meaning "Click me to see details!".
Try that, and you should get the crash.
I specialized the report to objects of type textfield.DateTime. 
This doesn't mean the issuue won't occur with different objects newly created by 
.createInstance()
and supporting com.sun.star.text.TextContent, but not yet actually inserted using 
.insertTextContent(range, object, absorb)) 

Hope this helps.
Comment 6 Buovjaga 2023-03-23 11:15:19 UTC
Created attachment 186152 [details]
GDB trace of crash

Ok, I did not understand that I need to step until that. I only pressed F8 once at first.

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6dfa9c7c0db91a71f3787226636864161d5367ca
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 23 March 2023
Comment 7 Buovjaga 2023-03-23 11:15:48 UTC
Created attachment 186153 [details]
Example file with macro
Comment 8 Buovjaga 2023-03-23 11:44:45 UTC
Bibisected with linux-64-6.3 to 2c9298e4f667a5dd7606d79890fcedfff0f66e26
SwXTextField::Impl FieldTypeClient: SwClient no more
Comment 9 Caolán McNamara 2023-04-13 14:52:24 UTC
I can reproduce, so lets give https://gerrit.libreoffice.org/c/core/+/150351 a go
Comment 10 Commit Notification 2023-04-13 18:26:10 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5464a1dad69c52d011b194baf7d543ce8dd27748

Resolves: tdf#152619 crash inspecting uninserted XFieldMaster

It will be available in 7.6.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 11 Caolán McNamara 2023-04-13 18:28:36 UTC
that seems to work for me in trunk, backport to 7-5 in gerrit
Comment 12 Commit Notification 2023-04-14 12:03:58 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/71c7c3dddb1291e262b1f8132b75e95fc6f9fa02

Resolves: tdf#152619 crash inspecting uninserted XFieldMaster

It will be available in 7.5.4.

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 Commit Notification 2023-04-17 11:03:29 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

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

Resolves: tdf#152619 crash inspecting uninserted XFieldMaster

It will be available in 7.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 14 Stéphane Guillou (stragu) 2023-04-25 22:16:21 UTC
Crash reproduced in 7.3.7.2 with attachment 186152 [details], report is https://crashreport.libreoffice.org/stats/crash_details/ecefe62b-ea3c-4273-863e-9b480571add3

Fix verified in:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5cd9de202765e243e41416802f3e4486b8a96f16
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Thank you all!
Comment 15 Commit Notification 2023-04-26 11:28:14 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-5-3":

https://git.libreoffice.org/core/commit/72f598e4b6f5250f250a3f3cce82e059f4fae34f

Resolves: tdf#152619 crash inspecting uninserted XFieldMaster

It will be available in 7.5.3.

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.