Bug 158450 - Crash when picking custom colour for column separator line
Summary: Crash when picking custom colour for column separator line
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: x86-64 (AMD64) Linux (All)
: medium critical
Assignee: Julien Nabet
URL:
Whiteboard: target:24.2.0 target:7.6.5
Keywords: bibisected, bisected, haveBacktrace, regression
Depends on:
Blocks: Color-Picker-Dialog Crash
  Show dependency treegraph
 
Reported: 2023-11-30 06:27 UTC by delyaerricson
Modified: 2023-12-05 09:03 UTC (History)
3 users (show)

See Also:
Crash report or crash signature: ["_ZNSt17_Function_handlerIFPN4weld6WindowEvEZN12SwColumnPageC4EPNS0_9ContainerEPNS0_16DialogControllerERK10SfxItemSetEUlvE_E9_M_invokeERKSt9_Any_data"]


Attachments
bt with debug symbols (7.03 KB, text/plain)
2023-11-30 16:37 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description delyaerricson 2023-11-30 06:27:16 UTC
Description:
I can choose one of the pre-defined colours for my separator line but libreoffice Writer crashes when I try to set it to a custom colour.

Steps to Reproduce:
1. Open LibreOffice Writer
2. Open Format > Columns
3. Increase the number of columns from 1 to 2
4. Click on Separator line > Color
5. Click on "Custom color" at the bottom of the colour picker pop-up

Actual Results:
Libreoffice crashes and restarts

Expected Results:
The custom colour picker should have opened and let me customize the colour for the line


Reproducible: Always


User Profile Reset: Yes

Additional Info:
I found a [reddit post](https://www.reddit.com/r/libreoffice/comments/vnkird/app_keep_crashing_after_changing_line_color/) which suggested turning off hardware acceleration and anti-aliasing in Options > View, but this did not resolve the issue.

Version: 7.5.7.1 (X86_64) / LibreOffice Community
Build ID: 50(Build:1)
CPU threads: 4; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: en-CA (en_CA.utf8); UI: en-US
7.5.7-3
Calc: threaded
Comment 1 Stéphane Guillou (stragu) 2023-11-30 16:31:06 UTC
Thank you for the report!

I reproduce in:
* 7.2 with signature std::_Function_handler<weld::Window*(), SwColumnPage::SwColumnPage(weld::Container*, weld::DialogController*, const SfxItemSet&)::<lambda()> >::_M_invoke : https://crashreport.libreoffice.org/stats/crash_details/83eb9ade-0070-49a5-8651-5e086e8a4f8a
* 7.3 with signature _ZNSt17_Function_handlerIFPN4weld6WindowEvEZN12SwColumnPageC4EPNS0_9ContainerEPNS0_16DialogControllerERK10SfxItemSetEUlvE_E9_M_invokeERKSt9_Any_data.lto_priv.902 : https://crashreport.libreoffice.org/stats/crash_details/1ac60ad0-b22d-4dec-9a07-a2e5635d3077
* 7.5.8.2 with signature _ZNSt17_Function_handlerIFPN4weld6WindowEvEZN12SwColumnPageC4EPNS0_9ContainerEPNS0_16DialogControllerERK10SfxItemSetEUlvE_E9_M_invokeERKSt9_Any_data : https://crashreport.libreoffice.org/stats/crash_details/9d60f617-caa4-4115-97a0-65b27d145c66
* 7.6.3.2: https://crashreport.libreoffice.org/stats/crash_details/c5aade8c-55cb-4d2f-91fa-893ec35c9c2b

Also in recent trunk build:

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

No repro in 7.1.

Bibisected with linux-64-7.2 to first bad build commit [7a729e501c4b37b2249b7c29a6a10e4aeb065ed6] which points to:

commit 862fd2fa19b64972247bde9b171ec828a30e1676
author	Caolán McNamara Mon Mar 08 17:18:06 2021 +0000
committer	Caolán McNamara Tue Mar 09 10:08:45 2021 +0100
defer getting toplevel for color picker until we need it
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112183

Caolán can you please have a look?
Comment 2 Julien Nabet 2023-11-30 16:37:51 UTC
Created attachment 191146 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 3 Julien Nabet 2023-11-30 16:40:16 UTC
When debugging this, I noticed that GetDialogController() returned nullptr in:
395      , m_xLineColorDLB(new ColorListBox(m_xBuilder->weld_menu_button("colorlb"),
396                  [this]{ return GetDialogController()->getDialog(); }))

See https://opengrok.libreoffice.org/xref/core/sw/source/ui/frmdlg/column.cxx?r=b542d904#395

I tried this patch locally:
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 028b9f1b209a..380bbb768f16 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -393,7 +393,7 @@ SwColumnPage::SwColumnPage(weld::Container* pPage, weld::DialogController* pCont
     , m_xTextDirectionFT(m_xBuilder->weld_label("textdirectionft"))
     , m_xTextDirectionLB(new svx::FrameDirectionListBox(m_xBuilder->weld_combo_box("textdirectionlb")))
     , m_xLineColorDLB(new ColorListBox(m_xBuilder->weld_menu_button("colorlb"),
-                [this]{ return GetDialogController()->getDialog(); }))
+                [pController]{ return pController->getDialog(); }))
     , m_xLineTypeDLB(new SvtLineListBox(m_xBuilder->weld_menu_button("linestylelb")))
     , m_xEd1(new SwPercentField(m_xBuilder->weld_metric_spin_button("width1mf", FieldUnit::CM)))
     , m_xEd2(new SwPercentField(m_xBuilder->weld_metric_spin_button("width2mf", FieldUnit::CM)))

it won't crash and open the custom colors window.
Comment 4 Julien Nabet 2023-11-30 16:48:34 UTC
Patch submitted on gerrit here:
https://gerrit.libreoffice.org/c/core/+/160164
Comment 5 Commit Notification 2023-12-01 17:10:16 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4f8bb267489b14aa1dab360786d8f99c763f03b4

tdf#158450: fix crash when picking custom colour for column separator line

It will be available in 24.2.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 6 Commit Notification 2023-12-01 20:58:36 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

Related: tdf#158450 use SfxTabPage::GetFrameWeld

It will be available in 24.2.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 7 Commit Notification 2023-12-04 12:20:53 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/9e82062325cc00d2c2974d02d6759015bffdde03

tdf#158450: fix crash when picking custom colour for column separator line

It will be available in 7.6.5.

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 8 Stéphane Guillou (stragu) 2023-12-05 09:03:36 UTC
Thank you all, verified as fixed in:

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