include/vcl/graphicfilter.hxx | 2 +- vcl/inc/graphic/UnoGraphicDescriptor.hxx | 2 +- vcl/source/filter/graphicfilter.cxx | 6 +++--- vcl/source/graphic/UnoGraphicDescriptor.cxx | 11 ++++------- vcl/source/graphic/UnoGraphicProvider.cxx | 10 ++++------ 5 files changed, 13 insertions(+), 18 deletions(-)
New commits: commit 64e22e91973343aea46928a4fe15db708a66b566 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Oct 2 12:25:14 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Oct 4 13:41:55 2025 +0200 ImportGraphics doesn't insert nullptrs anymore ... since commit 2da5506d1c2d9513a96de25f5782f706a108165f (vcl: Fix threaded reading of graphics, 2025-04-30). Change-Id: Ic472230454fb781541ee1ad5a00e7811deb3a8db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191846 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index 0e1d26cf64c6..d3c77ca25e8e 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -282,7 +282,7 @@ public: /// Imports multiple graphics. /// - /// The resulting graphic is added to rGraphics on success, nullptr is added on failure. + /// The resulting graphic is added to rGraphics on success, empty graphic is added on failure. SAL_DLLPRIVATE void ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGraphics, std::vector< std::unique_ptr<SvStream> > vStreams); /** diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index abb5b6366acd..e2985ba4336f 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -681,8 +681,8 @@ void GraphicFilter::MakeGraphicsAvailableThreaded(std::vector<Graphic*>& graphic assert(loadedGraphics.size() == toLoad.size()); for( size_t i = 0; i < toLoad.size(); ++i ) { - if(loadedGraphics[ i ] != nullptr) - toLoad[ i ]->ImplGetImpGraphic()->updateFromLoadedGraphic(loadedGraphics[ i ]->ImplGetImpGraphic()); + assert(loadedGraphics[ i ] != nullptr); + toLoad[ i ]->ImplGetImpGraphic()->updateFromLoadedGraphic(loadedGraphics[ i ]->ImplGetImpGraphic()); } } diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx index 267bf6813711..7d0ffbfbea78 100644 --- a/vcl/source/graphic/UnoGraphicProvider.cxx +++ b/vcl/source/graphic/UnoGraphicProvider.cxx @@ -453,12 +453,10 @@ uno::Sequence< uno::Reference<graphic::XGraphic> > SAL_CALL GraphicProvider::que { uno::Reference<graphic::XGraphic> xGraphic; - if (pGraphic) - { - rtl::Reference<unographic::Graphic> pUnoGraphic = new unographic::Graphic(); - pUnoGraphic->init(*pGraphic); - xGraphic = pUnoGraphic; - } + assert(pGraphic); + rtl::Reference<unographic::Graphic> pUnoGraphic = new unographic::Graphic(); + pUnoGraphic->init(*pGraphic); + xGraphic = pUnoGraphic; aRet.push_back(xGraphic); } commit 8c2d25398a4d8a6c0e94a96587cd7a14aa8a8a02 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Oct 2 12:21:08 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Oct 4 13:41:48 2025 +0200 Move reserve() call into GraphicFilter::ImportGraphics Change-Id: Iad1771dee9b6a5cadef068c119de016d2366eab2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191845 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 31928e81bf1f..abb5b6366acd 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -608,6 +608,7 @@ void GraphicFilter::ImportGraphics(std::vector< std::shared_ptr<Graphic> >& rGra rSharedPool.waitUntilDone(pTag); // Process data after import. + rGraphics.reserve(aContexts.size()); for (auto& rContext : aContexts) { rContext.m_pAccess.reset(); @@ -676,7 +677,6 @@ void GraphicFilter::MakeGraphicsAvailableThreaded(std::vector<Graphic*>& graphic streams.push_back(graphic->GetSharedGfxLink()->getDataContainer().getAsStream()); } std::vector< std::shared_ptr<Graphic>> loadedGraphics; - loadedGraphics.reserve(streams.size()); ImportGraphics(loadedGraphics, std::move(streams)); assert(loadedGraphics.size() == toLoad.size()); for( size_t i = 0; i < toLoad.size(); ++i ) commit ba1d19629ada024124a65ec62d18ec2c729f2927 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Oct 2 12:16:08 2025 +0500 Commit: Mike Kaganski <[email protected]> CommitDate: Sat Oct 4 13:41:42 2025 +0200 implCreate never gets a nullptr URL Change-Id: Iba9875f6b62dc72397512c9c0ba2b885df4744bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191843 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx b/vcl/inc/graphic/UnoGraphicDescriptor.hxx index 3631c504fa92..883282c4f6b3 100644 --- a/vcl/inc/graphic/UnoGraphicDescriptor.hxx +++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx @@ -108,7 +108,7 @@ private: GraphicDescriptor& operator=( const GraphicDescriptor& ) = delete; - void implCreate( SvStream& rIStm, const OUString* pPath ); + void implCreate( SvStream& rIStm, const OUString& rURL ); }; } diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx b/vcl/source/graphic/UnoGraphicDescriptor.cxx index a160c1d81e6b..02977b1723b7 100644 --- a/vcl/source/graphic/UnoGraphicDescriptor.cxx +++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx @@ -81,7 +81,7 @@ void GraphicDescriptor::init( const OUString& rURL ) std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( rURL, StreamMode::READ )); if( pIStm ) - implCreate( *pIStm, &rURL ); + implCreate( *pIStm, rURL ); } void GraphicDescriptor::init( const uno::Reference< io::XInputStream >& rxIStm, const OUString& rURL ) @@ -89,15 +89,12 @@ void GraphicDescriptor::init( const uno::Reference< io::XInputStream >& rxIStm, std::unique_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( rxIStm )); if( pIStm ) - implCreate( *pIStm, &rURL ); + implCreate( *pIStm, rURL ); } -void GraphicDescriptor::implCreate( SvStream& rIStm, const OUString* pURL ) +void GraphicDescriptor::implCreate( SvStream& rIStm, const OUString& rURL ) { - OUString aURL; - if( pURL ) - aURL = *pURL; - ::GraphicDescriptor aDescriptor( rIStm, &aURL ); + ::GraphicDescriptor aDescriptor( rIStm, &rURL ); mpGraphic = nullptr; maMimeType.clear();
