https://bugs.documentfoundation.org/show_bug.cgi?id=142635

--- Comment #21 from Mike Kaganski <[email protected]> ---
(In reply to Eike Rathke from comment #20)

Thank you Eike!
The patch has definitely made a difference - but not fixed it yet.
Now the pasted chart has an internal data table, resembling what happened
around OOo/LO 3.3.0.

If I avoid setting nBits to zero at line 1232 [1], then it works "as expected",
because it just ignores the "no such sheet" problem. So IMO there's still a
problem that the ScDocument used in the Chart export/import is not initialized
properly *in advance* (maybe even it should not be created, but reused, when
appropriate).

Let me paste the call stack of the first break on line 1232 [1] when selecting
all and Ctrl+C on my Windows system:

> [ 0] sclo.dll!lcl_ScAddress_Parse_OOo(const char16_t * p, const ScDocument & 
> rDoc, ScAddress & rAddr, ScRefFlags & rRawRes, ScAddress::ExternalInfo * 
> pExtInfo, ScRange * pRange, long * pSheetEndPos, const rtl::OUString * 
> pErrRef) Line 1232       C++
> [ 1] sclo.dll!lcl_ScAddress_Parse(const char16_t * p, const ScDocument & 
> rDoc, ScAddress & rAddr, const ScAddress::Details & rDetails, 
> ScAddress::ExternalInfo * pExtInfo, const 
> com::sun::star::uno::Sequence<com::sun::star::sheet::ExternalLinkInfo> * 
> pExternalLinks, long * pSheetEndPos, const rtl::OUString * pErrRef) Line 1487 
>       C++
> [ 2] sclo.dll!ScAddress::Parse(const rtl::OUString & r, const ScDocument & 
> rDoc, const ScAddress::Details & rDetails, ScAddress::ExternalInfo * 
> pExtInfo, const 
> com::sun::star::uno::Sequence<com::sun::star::sheet::ExternalLinkInfo> * 
> pExternalLinks, long * pSheetEndPos, const rtl::OUString * pErrRef) Line 1545 
>        C++
> [ 3] 
> sclo.dll!ScRangeStringConverter::GetStringFromXMLRangeString(rtl::OUString & 
> rString, const rtl::OUString & rXMLRange, const ScDocument & rDoc) Line 857 
> C++
> [ 4] sclo.dll!ScChart2DataProvider::convertRangeFromXML(const rtl::OUString & 
> sXMLRange) Line 2291    C++
> [ 5] xolo.dll!`anonymous namespace'::lcl_ConvertRange(const rtl::OUString & 
> rRange, const 
> com::sun::star::uno::Reference<com::sun::star::chart2::XChartDocument> & 
> xDoc) Line 77      C++
> [ 6] xolo.dll!SchXMLPlotAreaContext::startFastElement(long __formal, const 
> com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> 
> & xAttrList) Line 234 C++
> [ 7] xolo.dll!SvXMLImport::startFastElement(long Element, const 
> com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastAttributeList> 
> & Attribs) Line 815      C++
> [ 8] expwraplo.dll!`anonymous namespace'::Entity::startElement(const 
> `anonymous-namespace'::Event * pEvent) Line 471  C++
> [ 9] 
> expwraplo.dll!sax_fastparser::FastSaxParserImpl::callbackStartElement(const 
> unsigned char * localName, const unsigned char * prefix, const unsigned char 
> * URI, int numNamespaces, const unsigned char * * namespaces, int 
> numAttributes, const unsigned char * * attributes) Line 1302  C++
> [10] expwraplo.dll!call_callbackStartElement(void * userData, const unsigned 
> char * localName, const unsigned char * prefix, const unsigned char * URI, 
> int numNamespaces, const unsigned char * * namespaces, int numAttributes, int 
> __formal, const unsigned char * * attributes) Line 332  C++
> [11] libxml2.dll!xmlParseStartTag2(_xmlParserCtxt * ctxt, const unsigned char 
> * * pref, const unsigned char * * URI, int * tlen) Line 9670    C
> [12] libxml2.dll!xmlParseTryOrFinish(_xmlParserCtxt * ctxt, int terminate) 
> Line 11456 C
> [13] libxml2.dll!xmlParseChunk(_xmlParserCtxt * ctxt, const char * chunk, int 
> size, int terminate) Line 12351 C
> [14] expwraplo.dll!sax_fastparser::FastSaxParserImpl::parse() Line 1097       
> C++
> [15] expwraplo.dll!sax_fastparser::FastSaxParserImpl::parseStream(const 
> com::sun::star::xml::sax::InputSource & rStructSource) Line 906       C++
> [16] expwraplo.dll!sax_fastparser::FastSaxParser::parseStream(const 
> com::sun::star::xml::sax::InputSource & aInputSource) Line 1482   C++
> [17] xolo.dll!SvXMLImport::parseStream(const 
> com::sun::star::xml::sax::InputSource & aInputSource) Line 512   C++
> [18] chartcorelo.dll!chart::XMLFilter::impl_ImportStream(const rtl::OUString 
> & rStreamName, const rtl::OUString & rServiceName, const 
> com::sun::star::uno::Reference<com::sun::star::embed::XStorage> & xStorage, 
> const 
> com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> 
> & xFactory, const 
> com::sun::star::uno::Reference<com::sun::star::document::XGraphicStorageHandler>
>  & xGraphicStorageHandler, const 
> com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> & 
> xImportInfo) Line 469   C++
> [19] chartcorelo.dll!chart::XMLFilter::impl_Import(const 
> com::sun::star::uno::Reference<com::sun::star::lang::XComponent> & 
> xDocumentComp, const 
> com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & 
> rMediaDescriptor) Line 374     C++
> [20] chartcorelo.dll!chart::XMLFilter::filter(const 
> com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & 
> aDescriptor) Line 222       C++
> [21] chartcorelo.dll!chart::ChartModel::impl_load(const 
> com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & 
> rMediaDescriptor, const 
> com::sun::star::uno::Reference<com::sun::star::embed::XStorage> & xStorage) 
> Line 562    C++
> [22] chartcorelo.dll!chart::ChartModel::loadFromStorage(const 
> com::sun::star::uno::Reference<com::sun::star::embed::XStorage> & xStorage, 
> const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & 
> rMediaDescriptor) Line 755      C++
> [23] embobj.dll!OCommonEmbeddedObject::LoadDocumentFromStorage_Impl() Line 
> 549        C++
> [24] embobj.dll!OCommonEmbeddedObject::SwitchStateTo_Impl(long nNextState) 
> Line 191   C++
> [25] embobj.dll!OCommonEmbeddedObject::changeState(long nNewState) Line 459   
> C++
> [26] svtlo.dll!svt::EmbeddedObjectRef::TryRunningState(const 
> com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> & 
> xEmbObj) Line 819       C++
> [27] 
> sclo.dll!ScChartHelper::AddRangesIfProtectedChart(std::vector<ScRangeList,std::allocator<ScRangeList>>
>  & rRangesVector, const ScDocument & rDocument, SdrObject * pObject) Line 298 
>      C++
> [28] 
> sclo.dll!ScChartHelper::FillProtectedChartRangesVector(std::vector<ScRangeList,std::allocator<ScRangeList>>
>  & rRangesVector, const ScDocument & rDocument, const SdrPage * pPage) Line 
> 333       C++
> [29] sclo.dll!ScViewFunc::CopyToClipSingleRange(ScDocument * pClipDoc, const 
> ScRangeList & rRanges, bool bCut, bool bIncludeObjects) Line 277 C++
> [30] sclo.dll!ScViewFunc::CopyToClip(ScDocument * pClipDoc, const ScRangeList 
> & rRanges, bool bCut, bool bApi, bool bIncludeObjects, bool bStopEdit) Line 
> 212 C++
> [31] sclo.dll!ScViewFunc::CopyToClip(ScDocument * pClipDoc, bool bCut, bool 
> bApi, bool bIncludeObjects, bool bStopEdit) Line 178      C++
> [32] sclo.dll!ScCellShell::ExecuteEdit(SfxRequest & rReq) Line 1350   C++
> [33] sclo.dll!SfxStubScCellShellExecuteEdit(SfxShell * pShell, SfxRequest & 
> rReq) Line 7541   C++
> [34] sfxlo.dll!SfxDispatcher::Call_Impl(SfxShell & rShell, const SfxSlot & 
> rSlot, SfxRequest & rReq, bool bRecord) Line 257   C++
> [35] sfxlo.dll!SfxDispatcher::Execute_(SfxShell & rShell, const SfxSlot & 
> rSlot, SfxRequest & rReq, SfxCallMode eCallMode) Line 753   C++
> [36] sfxlo.dll!SfxBindings::Execute_Impl(SfxRequest & aReq, const SfxSlot * 
> pSlot, SfxShell * pShell) Line 1061       C++
> [37] sfxlo.dll!SfxDispatchController_Impl::dispatch(const 
> com::sun::star::util::URL & aURL, const 
> com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & aArgs, 
> const 
> com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener>
>  & rListener) Line 701     C++
> [38] sfxlo.dll!SfxOfficeDispatch::dispatch(const com::sun::star::util::URL & 
> aURL, const 
> com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & aArgs) 
> Line 262        C++
> [39] svtlo.dll!svt::`anonymous 
> namespace'::AsyncAccelExec::impl_ts_asyncCallback(LinkParamNone * __formal) 
> Line 480   C++
> [40] svtlo.dll!svt::`anonymous 
> namespace'::AsyncAccelExec::LinkStubimpl_ts_asyncCallback(void * instance, 
> LinkParamNone * data) Line 472      C++
> [41] vcllo.dll!Link<LinkParamNone *,void>::Call(LinkParamNone * data) Line 
> 111        C++
> [42] vcllo.dll!vcl::EventPoster::DoEvent_Impl(void * __formal) Line 53        
> C++
> [43] vcllo.dll!vcl::EventPoster::LinkStubDoEvent_Impl(void * instance, void * 
> data) Line 48   C++
> [44] vcllo.dll!Link<void *,void>::Call(void * data) Line 111  C++
> [45] vcllo.dll!ImplHandleUserEvent(ImplSVEvent * pSVEvent) Line 2232  C++
> [46] vcllo.dll!ImplWindowFrameProc(vcl::Window * _pWindow, SalEvent nEvent, 
> const void * pEvent) Line 2800    C++
> [47] vcllo.dll!SalFrame::CallCallback(SalEvent nEvent, const void * pEvent) 
> Line 308  C++
> [48] vclplug_winlo.dll!ImplHandleUserEvent(HWND__ * hWnd, __int64 lParam) 
> Line 4214   C++
> [49] vclplug_winlo.dll!SalFrameWndProc(HWND__ * hWnd, unsigned int nMsg, 
> unsigned __int64 wParam, __int64 lParam, bool & rDef) Line 5865      C++
> [50] vclplug_winlo.dll!SalFrameWndProcW(HWND__ * hWnd, unsigned int nMsg, 
> unsigned __int64 wParam, __int64 lParam) Line 5972  C++
> [51] user32.dll!UserCallWinProcCheckWow()     Unknown
> [52] user32.dll!DispatchMessageWorker()       Unknown
> [53] vclplug_winlo.dll!ImplSalDispatchMessage(const tagMSG * pMsg) Line 475   
> C++
> [54] vclplug_winlo.dll!ImplSalYield(bool bWait, bool bHandleAllCurrentEvents) 
> Line 506        C++
> [55] vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool 
> bHandleAllCurrentEvents) Line 581     C++
> [56] vcllo.dll!ImplYield(bool i_bWait, bool i_bAllEvents) Line 474    C++
> [57] vcllo.dll!Application::Yield() Line 559  C++
> [58] vcllo.dll!Application::Execute() Line 452        C++
> [59] sofficeapp.dll!desktop::Desktop::Main() Line 1600        C++
> [60] vcllo.dll!ImplSVMain() Line 202  C++
> [61] vcllo.dll!SVMain() Line 235      C++
> [62] sofficeapp.dll!soffice_main() Line 94    C++
> [63] soffice.bin!sal_main() Line 51   C
> [64] soffice.bin!main(int argc, char * * argv) Line 49        C
> [65] soffice.bin!invoke_main() Line 79        C++
> [66] soffice.bin!__scrt_common_main_seh() Line 288    C++
> [67] soffice.bin!__scrt_common_main() Line 331        C++
> [68] soffice.bin!mainCRTStartup(void * __formal) Line 17      C++
> [69] kernel32.dll!00007fffb0bb7034()  Unknown
> [70] ntdll.dll!00007fffb10c2651()     Unknown

At frame 0, rDoc has empty maTabNames, and its maTabs has a single element with
aName and aCodeName equal to "Sheet1", and aUpperName "SHEET1". It comes from
ScChart2DataProvider::m_pDocument (frame 4), which in turn comes from
chart::ChartModel::m_xDataProvider (frame 5), possibly created when xDocument
is created in frame 23.

At the same time, frame 27 has rDocument with empty maTabNames, but the single
maTabs element has aName equal to "Sheet.1", and aUpperName "SHEET.1"
(aCodeName is equal to "Sheet1"). It comes from frame 29, where rDoc is
obtained from GetViewData().GetDocument() - so it likely represents the current
active document from which we are copying.

And the same frame 29 has pClipDoc, which has a single "Sheet.1" in maTabNames,
and a single element in maTabs with aName and aCodeName equal to "Sheet.1", and
empty aUpperName. It is created right there, in the
ScViewFunc::CopyToClipSingleRange (the caller sends nullptr).

I see it, but I have absolutely no idea what to do with this all. I suppose
that either the lower frames (0-23) should use pClipDoc from frame 29, or they
should prepare their own document from rDoc from frame 29 ... so something
needs to be passed from frame 29 (27?) down to frame 23.

Or I may misunderstand it all completely ... it really looks too complicated,
how the copy to clipboard is implemented, with the intermediate fastparser
stage :(

Note that it's same when you put breakpoint to that line on Linux (even though
the end result differs), so possibly it's possible to debug there.

[1]
https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/address.cxx?r=fe687d1b#1232

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to