Bug 147503 - Crashes when trying to insert a hyperlink with XML Form Document
Summary: Crashes when trying to insert a hyperlink with XML Form Document
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium critical
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.6.0
Keywords: bibisectRequest, regression
Depends on:
Blocks: Crash XML_Form
  Show dependency treegraph
 
Reported: 2022-02-18 07:27 UTC by Saburo
Modified: 2023-04-24 11:58 UTC (History)
7 users (show)

See Also:
Crash report or crash signature: ["libc.so.6"]


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Saburo 2022-02-18 07:27:48 UTC
Description:
LibreOffice crashes only if the hyperlink is set to [New Document], [XML Form Document], or [Edit later].

Steps to Reproduce:
1.[Insert]-[Hyperlink]
2.[New Document] [Edit later]
  File: Something
  File type: XML Form Document
3.[Apply]or[OK] button click

Actual Results:
Force close after a few seconds.

Expected Results:
Continue work.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.3.1.1 / LibreOffice Community
Build ID: 75bdb7e01371355b35ec003f0e496b8afe00a42b
CPU threads: 2; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: ja-JP (ja_JP.UTF-8); UI: ja-JP
Calc: threaded
Comment 1 Saburo 2022-02-18 07:38:51 UTC
I made a mistake.

Description:
LibreOffice crashes only if the hyperlink is set to [New Document], [XML Form Document],[Edit later].
Comment 2 Tex2002ans 2022-02-18 08:13:49 UTC
Can confirm in:

Version: 7.3.0.3 (x64) / LibreOffice Community
Build ID: 0f246aa12d0eee4a0f7adcefbf7c878fc2238db3
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

Crashed a few seconds after pressing "Apply" in Step 3.
Comment 3 Timur 2022-02-19 13:54:38 UTC
To be determined if regression, if it didn't happen in older LO, would be High.
Comment 4 Saburo 2022-02-21 08:05:53 UTC
I tested on Windows + LO Portable.

4.3.7 nomal(wait a few seconds)
4.4   A dialog appears
Fatal Error
TransactionManage...
Owner instance already closed.Call was rejected!
5.X   A dialog appears
Fatal Error
Frame disposed.
6.0-  Force close after a few seconds.
Comment 5 raal 2022-11-14 08:14:16 UTC
(In reply to Saburo from comment #4)
> I tested on Windows + LO Portable.
> 
> 4.3.7 nomal(wait a few seconds)
> 4.4   A dialog appears
> Fatal Error
> TransactionManage...
> Owner instance already closed.Call was rejected!


regression
Comment 6 Stéphane Guillou (stragu) 2023-03-27 07:50:00 UTC
Repro in Calc with:

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

And in 7.5:

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

Crash report: https://crashreport.libreoffice.org/stats/crash_details/339cd3bd-2715-4ea9-9f5f-89dd3a948d05
Comment 7 Stéphane Guillou (stragu) 2023-03-27 07:50:33 UTC
(In reply to Stéphane Guillou (stragu) from comment #6)
> Repro in Calc with:

(crash report was in Writer)
Comment 8 Julien Nabet 2023-04-20 09:55:59 UTC
Code pointer:
    269         OUString aStrFlags('S');
    270         if (xExecuteInfo->bRbtEditLater)
    271         {
    272             aStrFlags += "H";
    273         }
    274         SfxStringItem aFlags (SID_OPTIONS, aStrFlags);
    275 
    276         // open url
    277         const SfxPoolItem* pReturn = xExecuteInfo->pDispatcher->ExecuteList(
    278                 SID_OPENDOC, SfxCallMode::SYNCHRON,
    279                 { &aName, &aFlags, &aFrame, &aReferer });

(see https://opengrok.libreoffice.org/xref/core/cui/source/dialogs/hldocntp.cxx?r=61346723#269)

If I remove lines 269-> 273 and use
SfxStringItem aFlags (SID_OPTIONS, "S");
it works as we may expect since it corresponds to the "Edit now" case.

I also try to use SfxCallMode::ASYNCHRON when we're in the "Edit later" case but I got:
warn:legacy.tools:31063:31063:sfx2/source/appl/appopen.cxx:1019: Hidden load process must be done synchronously! and it fails later in the same way.

With "Edit now", I also noticed this log:
"is there a frame int 0x5593c7db2280"

It seems quite a mess here :-(.
Comment 9 Julien Nabet 2023-04-23 07:39:52 UTC
Caolán: I don't know if XML forms are often used so I'm not sure a crash on them would be reported in the crashreport but would you have some idea here?

I retrieved some info in https://bugs.documentfoundation.org/show_bug.cgi?id=147503#c8 but then I'm a bit stuck.
Comment 10 Caolán McNamara 2023-04-23 19:32:35 UTC
Can't quite be sure what should happen but a place to start thinking is in

NewXForms where in the non-hidden (edit now) case xDocSh->nOwnerLockCount is 2 after SfxViewFrame::DisplayNewDocument so when xDocSh goes out of scope the document isn't closed, while in hidden the nOwnerLockCount is 1 and on out of scope goes to 0 and gets closed which seems to be the difference.
Comment 11 Caolán McNamara 2023-04-23 19:38:13 UTC
I can make it not crash by changing NewXForms from

SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );

to 

SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
if (pViewFrame)
    pViewFrame->GetFrame().Appear();

but then the XML Form Document will appear for a moment
Comment 12 Caolán McNamara 2023-04-23 19:52:10 UTC
I'm willing to give https://gerrit.libreoffice.org/c/core/+/150891 a go in trunk, seems to work and I don't see a (obvious) downside.
Comment 13 Commit Notification 2023-04-24 11:57:34 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5be0f62621a5ef66438cf2dc660be8e524588c15

tdf#147503 don't use SfxObjectShellLock for new xml forms document

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.