Bug 129412 - Crash when registered data source is not available.
Summary: Crash when registered data source is not available.
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
6.3.3.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.5.0 target:6.4.1 target:6.3.5
Keywords: bibisected, bisected, haveBacktrace, regression
Depends on:
Blocks:
 
Reported: 2019-12-15 10:40 UTC by Andreas Säger
Modified: 2020-01-28 09:58 UTC (History)
4 users (show)

See Also:
Crash report or crash signature: ["sc::PivotTableDataProvider::collectPivotTableData()"]


Attachments
Sheet with data source pivot (14.00 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-12-15 10:43 UTC, Andreas Säger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Säger 2019-12-15 10:40:57 UTC
Description:
Open the attached file with cell cursor on pivot table.
Click the chart icon to create a pivot chart.
This will crash the application after showing an info box with blue "i" icon:
"Error accessing data source 'Sprit':
com.sun.star.container.NoSuchElementException:
Sprit"
-----------------------------------
The pivot is based on a registered data source named "Sprit" and the combination of data source, pivot table and pivot chart worked well until I renamed the data source. Then the document crashed on open with the above info message. I opened the document with OpenOffice and removed the pivot chart. Now it crashes when you create a new chart. So the pivot chart is most likely the culprit.

Steps to Reproduce:
1. Open document
2. Cell cursor on pivot
3. Start chart wizard

Actual Results:
New blank spreadsheet
Data>Pivot>Create...
Create from registered data source, "Bibliography" for instance
Create an arbitrary pivot with one numeric data field at least (function Count also works with text fields)
Call the chart wizard

Expected Results:
No crash at least
Keep data and chart viewable even if it is based on a data source that is currently unavaillable.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Andreas Säger 2019-12-15 10:43:20 UTC
Created attachment 156594 [details]
Sheet with data source pivot
Comment 2 Andreas Säger 2019-12-15 10:46:56 UTC
The new submit form is somewhat confusing.

Under "Actual Results" I described more detailed steps to reproduce the issue from scratch.

I did not reset the user profile but tested with 2 separate profiles for LO6.0 and 6.3
Comment 3 MM 2019-12-15 13:44:18 UTC
Confirmed on windows 10 x64 with Version: 6.3.4.2 (x64)
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU threads: 12; OS: Windows 10.0; UI render: default; VCL: win

crashreport.libreoffice.org/stats/crash_details/8aac9d45-96ad-4de6-912d-380a3795dc85

If you click on a2,b2,c2,d1 you already get the 'Error accessing data source 'Sprit' [...]' error, but no crash.
When you try to make a chart, you do get one.
Comment 4 Julien Nabet 2019-12-15 18:17:12 UTC
On pc Debian x86-64 with master sources updated today + enable-dbgutil, I got an assert when doing this:
- open attached file
- click on cell included in pivot table
- click chart
=> popup error with "Error accessing data source 'Sprit'...
- click button
=> assertion
4  0x00007fffda0dcb85 in com::sun::star::uno::Reference<com::sun::star::sheet::XDataPilotResults>::operator->() const (this=0x7fffffff0570)
    at /home/julien/lo/libreoffice/include/com/sun/star/uno/Reference.h:426
#5  0x00007fffdaeab5d5 in sc::PivotTableDataProvider::collectPivotTableData() (this=0x55555d0cbf70) at /home/julien/lo/libreoffice/sc/source/ui/unoobj/PivotTableDataProvider.cxx:288
#6  0x00007fffdaeae019 in sc::PivotTableDataProvider::createValuesDataSource() (this=0x55555d0cbf70) at /home/julien/lo/libreoffice/sc/source/ui/unoobj/PivotTableDataProvider.cxx:657
#7  0x00007fffdaeaaee3 in sc::PivotTableDataProvider::createDataSource(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x55555d0cbf70, aArguments=
    uno::Sequence of length 4 = {...}) at /home/julien/lo/libreoffice/sc/source/ui/unoobj/PivotTableDataProvider.cxx:227
#8  0x00007fffd3a08e77 in chart::ChartModel::setArguments(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) (this=0x55555d07f3a0, aArguments=uno::Sequence of length 4 = {...})
    at /home/julien/lo/libreoffice/chart2/source/model/main/ChartModel.cxx:824
#9  0x00007fffdabeef06 in (anonymous namespace)::lcl_ChartInit(com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&, ScViewData*, rtl::OUString const&, bool)
    (xObj=uno::Reference to (class OCommonEmbeddedObject *) 0x55555c115210, pViewData=0x555558befc58, rRangeParam="DataPilot1", bRangeIsPivotTable=true)
    at /home/julien/lo/libreoffice/sc/source/ui/drawfunc/fuins2.cxx:197
Comment 5 Julien Nabet 2019-12-15 18:22:28 UTC
Eike:
this patch prevents from asserting:
diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
index fa77cd0f133a..d7979cda8cbe 100644
--- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
+++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
@@ -285,6 +285,8 @@ void PivotTableDataProvider::collectPivotTableData()
     m_aFieldOutputDescriptionMap.clear();
 
     uno::Reference<sheet::XDataPilotResults> xDPResults(pDPObject->GetSource(), uno::UNO_QUERY);
+    if (!xDPResults.is())
+        return;
     const uno::Sequence<uno::Sequence<sheet::DataResult>> xDataResultsSequence = xDPResults->getResults();
 
     double fNan;

however, it opens Chart dialog and at the end, chart is empty (as expected).
Any thoughts about a better solution than this naive patch?
(part of bt in my previous comment)
Comment 6 Xisco Faulí 2020-01-20 13:18:04 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=9009663deb8f0862f419fd99bf0b761c7f923eff

author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2017-02-26 22:48:06 +0100
committer	Tomaž Vajngerl <quikee@gmail.com>	2017-04-04 13:39:29 +0000
commit 9009663deb8f0862f419fd99bf0b761c7f923eff (patch)
tree ea25976de0919f9d2161037d83be0eace4c1070b
parent 1931b5b01c6fdaa204d26ec4b9675dad16373cf2 (diff)
tdf#83257 [API-CHANGE] Pivot chart implementation

Bisected with: bibisect-linux-64-5.4

Adding Cc: to Tomaž Vajngerl
Comment 7 Xisco Faulí 2020-01-20 13:26:11 UTC
(In reply to Julien Nabet from comment #5)
> Eike:
> this patch prevents from asserting:
> diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
> b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
> index fa77cd0f133a..d7979cda8cbe 100644
> --- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx
> +++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx
> @@ -285,6 +285,8 @@ void PivotTableDataProvider::collectPivotTableData()
>      m_aFieldOutputDescriptionMap.clear();
>  
>      uno::Reference<sheet::XDataPilotResults>
> xDPResults(pDPObject->GetSource(), uno::UNO_QUERY);
> +    if (!xDPResults.is())
> +        return;
>      const uno::Sequence<uno::Sequence<sheet::DataResult>>
> xDataResultsSequence = xDPResults->getResults();
>  
>      double fNan;
> 
> however, it opens Chart dialog and at the end, chart is empty (as expected).
> Any thoughts about a better solution than this naive patch?
> (part of bt in my previous comment)

Hi Julien,
Would you mind to submit a patch to gerrit?
Comment 8 Julien Nabet 2020-01-20 13:56:27 UTC
(In reply to Xisco Faulí from comment #7)
> ...
> Would you mind to submit a patch to gerrit?
No pb but I'll be able to do this only after my daytime job. If you want to submit it before, don't hesitate! :-)
Comment 9 Julien Nabet 2020-01-20 18:42:28 UTC
Done here:
https://gerrit.libreoffice.org/#/c/core/+/87096/
Comment 10 Commit Notification 2020-01-21 09:51:15 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

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

tdf#129412: Crash when registered data source is not available

It will be available in 6.5.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 11 Julien Nabet 2020-01-21 09:56:50 UTC
Backport for 6.4: https://gerrit.libreoffice.org/#/c/core/+/87124/
Comment 12 Commit Notification 2020-01-21 12:18:22 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

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

tdf#129412: Crash when registered data source is not available

It will be available in 6.4.1.

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 13 Commit Notification 2020-01-21 13:00:16 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

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

tdf#129412: Crash when registered data source is not available

It will be available in 6.3.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 14 Xisco Faulí 2020-01-28 09:58:13 UTC
Verified in

Version: 7.0.0.0.alpha0+
Build ID: aef7feb3e695ecf6d411f0777196dcc4281e201a
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

@Julien, thanks for fixing this issue!!