Created attachment 204100 [details] Data Provider used 2x and save This bug was filed from the crash reporting server and is br-1d145b40-e65b-48d0-954d-5aba6c7ffa5f. ========================================= PRECONDITION: new Calc spreadsheet, Data > Define Range (see Bug #169514 attachment DataRangeForDataProvider.ods) https://bugs.documentfoundation.org/attachment.cgi?id=204066 PROBLEM DESCRIPTION: Data > Data Provider select Range, CSV, URL=attached abc123.csv OK to import data do this another time: Data > Data Provider select Range, CSV, URL=attached abc123.csv OK to import data save file (see attaced "Data Provider used 2x and save") open file --> LO aborts this is reproducible abc123.csv is simply this: a1,a2,a3 b1,b2,b3 c1,c2,c3 N.B.: if Data Provider is used multiple times, content.xml contains multiple identical of theses elements (when removing all but 1 by text editor, there is no crash on open file): <calcext:data-mapping xlink:href="file:///home/micha/LibreOffice/bugreports/abc123.csv" calcext:provider="org.libreoffice.calc.csv" calcext:frequency="0" calcext:id="org.libreoffice.calc.csv" calcext:database-name="Neue_Datenbank"> <calcext:data-transformations/> </calcext:data-mapping> Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 480ef73deef62c458e5735cd496a1d74ef408ed8 CPU threads: 2; OS: Linux 6.8; UI render: default; VCL: gtk3 Locale: de-DE (de_DE.UTF-8); UI: en-US Calc: threaded
Created attachment 204101 [details] simple 3 lines CSV file
Created attachment 204129 [details] another example with several Data Provider operations if after several Data Provider operations a File > Reload is done, there is also a crash, see https://crashreport.libreoffice.org/stats/crash_details/b02e80cc-31f8-42aa-b78f-92f1f9bf8620
repro in Version: 25.8.2.2 (X86_64) Build ID: d401f2107ccab8f924a8e2df40f573aab7605b6f CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win Locale: en-US (en_US); UI: en-US Calc: CL threaded and Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 620(Build:0) CPU threads: 32; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win Locale: en-US (en_US); UI: en-US Calc: CL threaded
Created attachment 204230 [details] GDB trace of crash Trace of crash when opening attachment 204100 [details]
It crashes in the same way, if the <calcext:data-mapping> elements use different csv sources and different database ranges. And that would be a legitimate use of the "Data Provider" feature. Somewhere the sc::ExternalDataSource element lost the URL. There is something wrong with ScXMLMappingContext, because I get its dtor two times, in the first call with 1 element in rDataSources and in the second call with 2 elements in rDataSources. If I delete the refreshed item from rDataSources, it does no longer crash. But that is no solution, because then the link to the csv-file is lost and command "Refresh Data Provider" is not possible.
Changing rDataSources[0] to rDataSources.back() in https://opengrok.libreoffice.org/xref/core/sc/source/filter/xml/xmlmappingi.cxx?r=6b3089df68caed32e4fba981ffa3e33c74fbb515#120 makes that the file opens without crash. But then "Refresh Data Provider" crashes :(
My suggestion for a fix is now in https://gerrit.libreoffice.org/c/core/+/194433.
Regina Henschel committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c6ea5d2d639eb0d820ce4269c1a0c7a4ff0c073b tdf#169541 DataProvider avoid corrupt backreference It will be available in 26.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.
Regina Henschel committed a patch related to this issue. It has been pushed to "libreoffice-25-8": https://git.libreoffice.org/core/commit/39948910b829d6ce93dd8fbc89095a3f772df0e9 tdf#169541 DataProvider avoid corrupt backreference It will be available in 25.8.4. 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.