Bug 163640 - Assert fails in debug build when drag create a text box
Summary: Assert fails in debug build when drag create a text box
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
25.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Textbox Crash-Assert
  Show dependency treegraph
 
Reported: 2024-10-26 23:31 UTC by Regina Henschel
Modified: 2025-01-11 18:04 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
CallStack by VS 2022 (3.07 KB, text/plain)
2024-10-26 23:31 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2024-10-26 23:31:06 UTC
Created attachment 197256 [details]
CallStack by VS 2022

Start new presentation.
Change layout to "Title, Content".
Enter four lines in content box, e.g One, Two, Three, Four.
Click outside the content box to leave it.
Drag content box half of its width.
Enter content box.
Select all.
Apply numbering type "1." from the drop-down list in the toolbar.
Click outside the content box.
Click on the text box icon.
Click on the right side of the content box, hold mouse button down and drag right-down to create a text box.
Release mouse button -> Crash

The failing assert command is in #2832 in
    for (sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++)
    {
        sal_Int16 nDepth = mpTextEditOutliner->GetDepth(nPara);
        assert(nDepth >= 0 && nDepth <= 15);
        sal_uInt16 nParaDepth = 1 << static_cast<sal_uInt16>(nDepth);
        if (!(nLevel & nParaDepth))
            nLevel += nParaDepth;
    }
in svx/source/svdraw/svdedxv.cxx

The value of nDepth is -1.

The value -1 is correct, because an empty paragraph in the text box has no list. The execution should not be in that loop at all, when drag-creating a text box.

The changes in the content box are essential to reproduce the bug.
Comment 1 Samuel Carleial 2024-10-27 14:06:09 UTC
I tried to replicate the steps, and could not detect any crash. Not sure whether the last steps were so clear, but my text boxes appeared after pressing on the content box.

Maybe share your version and the file for more clarity


== testing ==
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 3287deb82ef0ee2048f733ae981961f527888727
CPU threads: 8; OS: macOS 13.7; UI render: Skia/Metal; VCL: osx
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: threaded

Version: 24.8.2.1 (X86_64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 8; OS: macOS 13.7; UI render: Skia/Metal; VCL: osx
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: threaded
Comment 2 Regina Henschel 2024-10-27 14:44:27 UTC
You need a debug build for to reproduce the error. My debug build is of state e3583eff43d3aa54fc7e2c2ba890a0835d47e9d3, that is Tue Oct 22 20:10:54 2024 +0200. The build is a Windows build with WSL.
Comment 3 Patrick (volunteer) 2024-10-27 18:34:52 UTC
I am able to reproduce this bug on macOS in my local master debug build:

Version: 25.2.0.0.alpha0+ (AARCH64) / LibreOffice Community
Build ID: 91a75920166e1cb64d6b7e6be1980a93bd163c9a
CPU threads: 8; OS: macOS 15.0.1; UI render: Skia/Metal; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded


The same assert in svdedxv.cxx:2832 is triggered when nDepth is -1:

frame #1: 0x000000010cd6a200 libsvxcorelo.dylib`SdrObjEditView::GetSelectionLevel(this=0x000000013f617c00) const at svdedxv.cxx:2832:9
   2829	    for (sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++)
   2830	    {
   2831	        sal_Int16 nDepth = mpTextEditOutliner->GetDepth(nPara);
-> 2832	        assert(nDepth >= 0 && nDepth <= 15);
   2833	        sal_uInt16 nParaDepth = 1 << static_cast<sal_uInt16>(nDepth);
   2834	        if (!(nLevel & nParaDepth))
   2835	            nLevel += nParaDepth;
(lldb) print nDepth
(sal_Int16) -1