Description: After successfully running the provided Basic subroutine, the LibreOffice application allows for the initial inspection of the UNO object (textDoc) in the Watch Window. The variable `textDoc`, its value, and type ("com.sun.star.text.TextDocument") are visible. However, attempting to perform a deeper inspection, either by double-clicking the variable or clicking the drop-down option, results in a consistent crash of LibreOffice. The crash occurs specifically during attempts to inspect the variable further. The issue persists even after restarting LibreOffice, resetting the user profile, and running in Safe Mode. Steps to Reproduce: 1.Open LibreOffice and create a new Basic module. 2.Add the following Basic subroutine: `Sub Example Dim textDoc As Object : textDoc = CreateUnoService("com.sun.star.text.TextDocument") End Sub` 3.Compile and execute the subroutine successfully. 4. Set a breakpoint at the `End Sub` line. 5. Debug the subroutine and observe the `textDoc` object in the Watch Window. 6. Double-click the `textDoc` variable or click the drop-down option to inspect the `textDoc` object further. Actual Results: LibreOffice allows for the initial inspection of the `textDoc` object in the Watch Window, displaying the variable's value and type. However, attempting to perform a deeper inspection by double-clicking the variable or clicking the drop-down option results in a crash of LibreOffice. Expected Results: The Watch Window should allow both initial and deeper inspection of the `textDoc` object without causing LibreOffice to crash. Reproducible: Always User Profile Reset: Yes Additional Info: Version: 7.6.4.1 (X86_64) / LibreOffice Community Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1 CPU threads: 20; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win Locale: en-GB (en_US); UI: en-GB Calc: CL threaded
(In reply to Henrry John from comment #0) > After successfully running the provided Basic subroutine, Have you accidentally forgot to provide the subroutine?
(In reply to Henrry John from comment #0) > 2.Add the following Basic subroutine: > `Sub Example > Dim textDoc As Object : textDoc = > CreateUnoService("com.sun.star.text.TextDocument") > End Sub` Sorry, I see it.
Repro using Version: 7.6.4.1 (X86_64) / LibreOffice Community Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1 CPU threads: 24; OS: Windows 10.0 Build 22631; UI render: Skia/Vulkan; VCL: win Locale: ru-RU (en_US); UI: en-US Calc: CL threaded https://crashreport.libreoffice.org/stats/crash_details/20ba31b1-1f7e-4dba-b52a-853381899563
(In reply to Mike Kaganski from comment #3) > Repro using Version: 7.6.4.1 (X86_64) / LibreOffice Community > Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1 > CPU threads: 24; OS: Windows 10.0 Build 22631; UI render: Skia/Vulkan; VCL: > win > Locale: ru-RU (en_US); UI: en-US > Calc: CL threaded > > https://crashreport.libreoffice.org/stats/crash_details/20ba31b1-1f7e-4dba- > b52a-853381899563 About the above link, am I supposed to do something with that? Apologies in advance since this is the first time I am ever reporting a bug, so I'm a bit confused.
(In reply to Henrry John from comment #4) > About the above link, am I supposed to do something with that? No, it is an additional data from my reproducing crash, intended to help whoever decides to fix it. Thanks for filing the bug. If some additional information would be required from you, a reply will ask it explicitly, don't worry.
Created attachment 191598 [details] gdb bt On pc Debian x86-64 with master sources updated today, I could reproduce this.
The pb is m_pDocShell->GetDoc() returns null whereas macro just created ""com.sun.star.text.TextDocument" object. Synchro pb? No idea how to fix this.
(In reply to Julien Nabet from comment #7) > The pb is m_pDocShell->GetDoc() returns null whereas macro just created > ""com.sun.star.text.TextDocument" object. Synchro pb? No, it is correct: there is no document in the "com.sun.star.text.TextDocument" UNO object created like this (see Writer_SwTextDocument_get_implementation). The code in sw/source/uibase/uno/unotxdoc.cxx wrongly expects m_pDocShell->GetDoc() to return a non-null value. In line 2085, there should be a check for this (and I bet, that there will be lots of similar things over the file).
FTR: an example how this works is in SfxFrameLoader_Impl::load [1], which employs the Frame-Controller-Model Paradigm [2] [3]. In line 707, it creates an instance of the class (e.g., "com.sun.star.text.TextDocument"); then it either calls its attachResource (ln 713), or load (ln 720), to actually create/load the document. Before calling these, the object is not properly initialized. Possibly the most correct is to have a check in the beginning of the UNO methods implementations, that would check if the doc is, and throw NotInitializedException [4] if it is not. [1] https://opengrok.libreoffice.org/xref/core/sfx2/source/view/frmload.cxx?r=789a737a#706 [2] https://wiki.documentfoundation.org/Documentation/DevGuide/Office_Development#Frame-Controller-Model_Paradigm_in_LibreOffice [3] https://wiki.documentfoundation.org/Documentation/DevGuide/Office_Development#Getting_Frames%2C_Controllers_and_Models_from_Each_Other [4] https://api.libreoffice.org/docs/idl/ref/exceptioncom_1_1sun_1_1star_1_1lang_1_1NotInitializedException.html
https://gerrit.libreoffice.org/c/core/+/161366
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/4df22b4d3d4ae1ec0c4d32f614bd2cd8ec13143e tdf#158862: check if document is initialized It will be available in 24.8.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.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-24-2": https://git.libreoffice.org/core/commit/b7faeeb19254a9cb696050016be052d776b2ef99 tdf#158862: check if document is initialized It will be available in 24.2.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.
(In reply to Commit Notification from comment #12) > Mike Kaganski committed a patch related to this issue. > It has been pushed to "libreoffice-24-2": > > https://git.libreoffice.org/core/commit/ > b7faeeb19254a9cb696050016be052d776b2ef99 > > tdf#158862: check if document is initialized > > It will be available in 24.2.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. Thank you for the quick fix of the bug. As an average user, what should I do next? Should I wait for the next LibreOffice update to see the patch implemented, or is there something else I need to do? Apologies if this is a redundant question; I'm not familiar with software development cycles so there is a bit of confusion in my part.
(In reply to Henrry John from comment #13) You may wait for the releases - see https://wiki.documentfoundation.org/ReleasePlan for schedule. If you want to test, you may download dailies - as suggested in the commit notifications. Note that pre-release builds indeed are not intended for business-critical use, so only suitable for testing purposes.