Bug 138698 - Assertion when switching back to format tab in Field format during Table edition
Summary: Assertion when switching back to format tab in Field format during Table edition
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.3.0 target:7.2.3
Keywords: haveBacktrace
Depends on:
Blocks: Crash-Assert
  Show dependency treegraph
 
Reported: 2020-12-06 20:05 UTC by Julien Nabet
Modified: 2021-11-02 08:52 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
bt with debug symbols (9.62 KB, text/plain)
2020-12-06 20:06 UTC, Julien Nabet
Details
bt with debug symbols (9.71 KB, text/plain)
2021-11-01 08:27 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Nabet 2020-12-06 20:05:50 UTC
Description:
On pc Debian x86-64 with master sources updated today, I got an assertion when switching back to format tab in Field format during Table edition.

Steps to Reproduce:
1. Retrieve https://bugs.documentfoundation.org/attachment.cgi?id=167880
2. Launch LO with the retrieved file
3. Edit table
4. Click "..." button at right of "Format example"
5. Click "Alignment" tab
6. Click "Format" tab (to come back to the initial tab)

Actual Results:
Assertion

Expected Results:
No assertion


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.0.0.alpha0+
Build ID: b0e4f29560671d48c3943b6d0165c91c7ba91fd5
CPU threads: 12; OS: Linux 5.9; UI render: default; VCL: gtk3
Locale: en-US (fr_FR.UTF-8); UI: en-US
Calc: threaded
Comment 1 Julien Nabet 2020-12-06 20:06:11 UTC
Created attachment 167884 [details]
bt with debug symbols
Comment 2 Julien Nabet 2020-12-06 20:09:36 UTC
It can be reproduced with a brand new embedded HSQLDB odb file.
Comment 3 Aron Budea 2020-12-07 02:38:05 UTC
Confirmed using LO 7.2.0.0.alpha0+ (4400f3c46ce838d8ba304205f1d710dd4f9001dc) / Ubuntu.
Comment 4 Julien Nabet 2021-11-01 08:27:39 UTC
Created attachment 176050 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce the same assertion.

Code pointer, the page is created from SbaSbAttrDlg::SbaSbAttrDlg (see https://opengrok.libreoffice.org/xref/core/dbaccess/source/ui/dlg/dlgattr.cxx?r=77af4cb9#36)
+ SbaSbAttrDlg::PageCreated

Taking a look at the pool, we see only:
(243, 245), (10086, 10086), (10580, 10580)

10580 = SID_ATTR_NUMBERFORMAT_ONE_AREA (see https://opengrok.libreoffice.org/xref/core/include/svx/svxids.hrc?r=04c7c90f#540)
86 must be SID_ATTR_NUMBERFORMAT_INFO (see https://opengrok.libreoffice.org/xref/core/include/svx/svxids.hrc?r=04c7c90f#233)

they must be from SvxNumberFormatTabPage::pRanges (see https://opengrok.libreoffice.org/xref/core/cui/source/tabpages/numfmt.cxx?r=fa311ad6#59)

Remark:
1) where do 243 and 245 come from?
2) why don't we see SID_ATTR_NUMBERFORMAT_NOLANGUAGE and SID_ATTR_NUMBERFORMAT_SOURCE in the pool whereas they're in SvxNumberFormatTabPage::pRanges


Anyway, 11569 (which corresponds to SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD) isn't in the pool and that's the main problem.
Comment 5 Julien Nabet 2021-11-01 08:55:10 UTC
Noel: it seems a pool pb but don't know how to tackle this.
I tried to provide the SID in:
SbaSbAttrDlg::PageCreated
     51 void SbaSbAttrDlg::PageCreated(const OString& rPageId, SfxTabPage& rTabPage)
     52 {
     53     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
     54     if (rPageId == "format")
     55     {
     56         aSet.Put (SvxNumberInfoItem( pNumberInfoItem->GetNumberFormatter(), static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO)));
     57         rTabPage.PageCreated(aSet);
     58     }
     59 }

indeed, I think there should be an else case to provide alignment SID case but when I tried this but it seems the pool stays unmodified.
Comment 6 Julien Nabet 2021-11-01 11:04:01 UTC
Caolán: trying to understand how the pool and SID worked, I noticed https://cgit.freedesktop.org/libreoffice/core/commit/?id=2f13f0693de4c301898f304999225738334aadb0
tdf#129300 If it would create no change, don't force it
otherwise a bogus "change" from the parent style is shown in the organizer...

I don't consider it as the root cause but rather as a patch which revealed a pb (like Noel's patches about typing SID constants).
Indeed, it seems there are different SID for aligment part and what worked for sc module seems to not work for dbaccess (see my previous comments).
Comment 7 Caolán McNamara 2021-11-01 14:28:12 UTC
I feel this originates at

commit 755ad6834625488c5d31d4bacc9370eae7ffd8f3
Date:   Tue Oct 5 11:15:56 2010 -0400

    Ported calc-distributed-cell-text-*.diff from ooo-build.

where a new calc feature was added, and this dialog is also used in this base case but the feature doesn't exist there
Comment 8 Caolán McNamara 2021-11-01 14:58:56 UTC
So I think the "distributed" option shouldn't be available in this dialog from base (but it should continue to appear in calc) and this special handling should be skipped if the option is unavailable. https://gerrit.libreoffice.org/c/core/+/124552
Comment 9 Commit Notification 2021-11-01 16:12:32 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2bd6876f0f4596eb4ffad1109ca0c2896f9bda84

tdf#138698 remove/ignore 'distributed' if feature is unknown

It will be available in 7.3.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 10 Caolán McNamara 2021-11-01 16:13:43 UTC
done in trunk, backport to 7-2 in gerrit
Comment 11 Julien Nabet 2021-11-01 17:02:22 UTC
Since I could already test it, let's put this one to VERIFIED
Comment 12 Commit Notification 2021-11-02 08:52:40 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/2c59baecb325211e5f01878b517265ce658de4fc

tdf#138698 remove/ignore 'distributed' if feature is unknown

It will be available in 7.2.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.