chart2/inc/ChartModel.hxx | 2 chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx | 7 --- chart2/source/controller/main/ChartController.cxx | 2 chart2/source/controller/main/ElementSelector.cxx | 5 +- chart2/source/model/main/ChartModel.cxx | 23 ++++------ chart2/source/tools/ChartViewHelper.cxx | 4 - drawinglayer/source/primitive2d/sceneprimitive2d.cxx | 6 ++ 7 files changed, 25 insertions(+), 24 deletions(-)
New commits: commit 5f69e0da74e726206768155a74fec36f1a926f5f Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Jun 15 20:26:45 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Wed Jun 18 07:54:36 2025 +0200 use more concrete UNO classes Change-Id: I50cc798040c691ef95d351ba3869eebbb912784a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186592 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index eff3647a8640..eb660c030593 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -474,6 +474,8 @@ public: css::uno::Reference< css::util::XNumberFormatsSupplier > const & getNumberFormatsSupplier(); + const rtl::Reference<ChartView> & createChartView(); + ChartView* getChartView() const; const rtl::Reference< ::chart::Diagram > & getFirstChartDiagram() { return m_xDiagram; } diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx index 73b8780ca718..f7ed5ca5165b 100644 --- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx +++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx @@ -102,12 +102,7 @@ rtl::Reference< ::chart::ChartView > const & Chart2ModelContact::getChartView() // get the chart view rtl::Reference<ChartModel> xChartModel( m_xChartModel ); if( xChartModel ) - { - auto xInstance = xChartModel->createInstance( CHART_VIEW_SERVICE_NAME ); - auto pChartView = dynamic_cast<ChartView*>(xInstance.get()); - assert(!xInstance || pChartView); - m_xChartView = pChartView; - } + m_xChartView = xChartModel->createChartView(); } return m_xChartView; } diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 68d16fa3f39a..23cd1e1a75fd 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -569,7 +569,7 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo rtl::Reference< ChartModel > xFact = getChartModel(); if( xFact.is()) { - m_xChartView = dynamic_cast<::chart::ChartView*>(xFact->createInstance( CHART_VIEW_SERVICE_NAME ).get()); + m_xChartView = xFact->createChartView(); GetDrawModelWrapper(); m_xChartView->addModeChangeListener(this); } diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index 143fa3886039..36ea5dabfc18 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -27,6 +27,7 @@ #include <ObjectIdentifier.hxx> #include <ChartController.hxx> #include <ChartModel.hxx> +#include <ChartView.hxx> #include <cppuhelper/supportsservice.hxx> #include <o3tl/safeint.hxx> @@ -115,10 +116,10 @@ void SelectorListBox::UpdateChartElementsListAndSelection() if ( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL || eType == OBJECTTYPE_SHAPE ) bAddSelectionToList = true; - Reference< uno::XInterface > xChartView; + rtl::Reference< ChartView > xChartView; rtl::Reference< ChartModel > xFact = xChartController->getChartModel(); if( xFact.is() ) - xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME ); + xChartView = xFact->createChartView(); ChartView* pExplicitValueProvider = nullptr; //ExplicitValueProvider::getExplicitValueProvider(xChartView); this creates all visible data points, that's too much ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ ); lcl_addObjectsToList( aHierarchy, ::chart::ObjectHierarchy::getRootNodeOID(), m_aEntries, 0, xChartDoc ); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index c422e6869495..ee6c483a09e6 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -1078,8 +1078,7 @@ embed::VisualRepresentation SAL_CALL ChartModel::getPreferredVisualRepresentatio Sequence< sal_Int8 > aMetafile; //get view from old api wrapper - Reference< datatransfer::XTransferable > xTransferable( - createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY ); + Reference< datatransfer::XTransferable > xTransferable( createChartView() ); if( xTransferable.is() ) { datatransfer::DataFlavor aDataFlavor( lcl_aGDIMetaFileMIMEType, @@ -1121,8 +1120,7 @@ uno::Any SAL_CALL ChartModel::getTransferData( const datatransfer::DataFlavor& a try { //get view from old api wrapper - Reference< datatransfer::XTransferable > xTransferable( - createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY ); + Reference< datatransfer::XTransferable > xTransferable( createChartView() ); if( xTransferable.is() && xTransferable->isDataFlavorSupported( aFlavor )) { @@ -1207,12 +1205,7 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString } else if(rServiceSpecifier == CHART_VIEW_SERVICE_NAME) { - if(!mxChartView.is()) - { - mxChartView = new ChartView( m_xContext, *this); - } - - return static_cast< ::cppu::OWeakObject* >( mxChartView.get() ); + return static_cast< ::cppu::OWeakObject* >( createChartView().get() ); } else { @@ -1229,6 +1222,13 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString return nullptr; } +const rtl::Reference<ChartView>& ChartModel::createChartView() +{ + if(!mxChartView.is()) + mxChartView = new ChartView( m_xContext, *this); + return mxChartView; +} + Reference< uno::XInterface > SAL_CALL ChartModel::createInstanceWithArguments( const OUString& rServiceSpecifier , const Sequence< Any >& Arguments ) { @@ -1332,8 +1332,7 @@ OUString SAL_CALL ChartModel::dump(OUString const & kind) } // kind == "shapes": - uno::Reference< qa::XDumper > xDumper( - createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY ); + uno::Reference< qa::XDumper > xDumper( createChartView() ); if (xDumper.is()) return xDumper->dump(kind); diff --git a/chart2/source/tools/ChartViewHelper.cxx b/chart2/source/tools/ChartViewHelper.cxx index 8011da3c171c..dc91c4361493 100644 --- a/chart2/source/tools/ChartViewHelper.cxx +++ b/chart2/source/tools/ChartViewHelper.cxx @@ -19,6 +19,7 @@ #include <ChartViewHelper.hxx> #include <ChartModel.hxx> +#include <ChartView.hxx> #include <servicenames.hxx> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -36,8 +37,7 @@ void ChartViewHelper::setViewToDirtyState(const rtl::Reference<::chart::ChartMod { if (xChartModel.is()) { - Reference<util::XModifyListener> xModifyListener( - xChartModel->createInstance(CHART_VIEW_SERVICE_NAME), uno::UNO_QUERY); + Reference<util::XModifyListener> xModifyListener(xChartModel->createChartView()); if (xModifyListener.is()) { lang::EventObject aEvent(static_cast<cppu::OWeakObject*>(xChartModel.get())); commit f2d79a8d859e187969482caf0030368aa4539c51 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jun 17 21:13:38 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jun 18 07:54:22 2025 +0200 attempt to fix CppunitTest_svx_unit I see failures on the mac buildbots lately that look like multithreaded access to bitmap stuff. Turn off multithreading here if skia is active. Stack looks like: Fatal exception: Signal 6 Stack: #0 0 libuno_sal.dylib.3 0x000000010b431e4c _ZN3sal13backtrace_getEj + 60 #1 1 libuno_sal.dylib.3 0x000000010b455149 _ZN12_GLOBAL__N_110printStackEi + 41 #2 2 libuno_sal.dylib.3 0x000000010b46f542 _ZN12_GLOBAL__N_121signalHandlerFunctionEiP9__siginfoPv.cold.1 + 34 #3 3 libuno_sal.dylib.3 0x000000010b454ff4 _ZN12_GLOBAL__N_121signalHandlerFunctionEiP9__siginfoPv + 740 #4 4 libsystem_platform.dylib 0x00007ff807942fdd _sigtramp + 29 #5 5 ??? 0x0000000000000000 0x0 + 0 #6 6 libsystem_c.dylib 0x00007ff807839a39 abort + 126 #7 7 libsystem_c.dylib 0x00007ff807838d1c err + 0 #8 8 libvcllo.dylib 0x0000000112cc2d23 _ZN13SkiaSalBitmap13ReleaseBufferEP12BitmapBuffer16BitmapAccessModeb.cold.2 + 35 #9 9 libvcllo.dylib 0x00000001129082f7 _ZN13SkiaSalBitmap13ReleaseBufferEP12BitmapBuffer16BitmapAccessModeb + 855 #10 10 libvcllo.dylib 0x00000001126664fd _ZN16BitmapInfoAccessD2Ev + 61 #11 11 libdrawinglayerlo.dylib 0x00000001221ee37a _ZN12drawinglayer7texture17GeoTexSvxBitmapExD2Ev + 74 #12 12 libdrawinglayerlo.dylib 0x00000001221e62bf _ZN12drawinglayer11processor3d18DefaultProcessor3D33impRenderBitmapTexturePrimitive3DERKNS_11primitive3d24BitmapTexturePrimitive3DE + 543 #13 13 libdrawinglayerlo.dylib 0x00000001221e4c38 _ZN12drawinglayer11processor3d15BaseProcessor3D7processERKNS_11primitive3d20Primitive3DContainerE + 88 #14 14 libdrawinglayerlo.dylib 0x00000001221e7049 _ZN12drawinglayer11processor3d18DefaultProcessor3D22processBasePrimitive3DERKNS_11primitive3d15BasePrimitive3DE + 249 #15 15 libdrawinglayerlo.dylib 0x00000001221e4c38 _ZN12drawinglayer11processor3d15BaseProcessor3D7processERKNS_11primitive3d20Primitive3DContainerE + 88 #16 16 libdrawinglayerlo.dylib 0x000000012218d3d7 _ZZNK12drawinglayer11primitive2d16ScenePrimitive2D21create2DDecompositionERKNS_8geometry17ViewInformation2DEEN8Executor6doWorkEv + 23 #17 17 libcomphelper.dylib 0x000000010b9e39f1 _ZN10comphelper10ThreadTask4execEv + 33 #18 18 libcomphelper.dylib 0x000000010b9e5212 _ZN10comphelper10ThreadPool12ThreadWorker7executeEv + 306 #19 19 libuno_salhelpergcc3.dylib.3 0x000000010aebe3f0 _ZThn16_N9salhelper6Thread3runEv + 32 #20 20 libuno_salhelpergcc3.dylib.3 0x000000010aebeb5f threadFunc + 15 #21 21 libuno_sal.dylib.3 0x000000010b45c151 _ZL21osl_thread_start_ImplPv + 129 #22 22 libsystem_pthread.dylib 0x00007ff80791418b _pthread_start + 99 #23 23 libsystem_pthread.dylib 0x00007ff80790fae3 thread_start + 15 Change-Id: I695e3d675f996aee6ea6b889eb78c39e4dbf509c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186632 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 02c51b01af53..930dcda34e37 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -34,6 +34,7 @@ #include <basegfx/raster/bzpixelraster.hxx> #include <utility> #include <vcl/BitmapTools.hxx> +#include <vcl/skia/SkiaHelper.hxx> #include <comphelper/threadpool.hxx> #include <comphelper/lok.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -422,7 +423,10 @@ namespace drawinglayer::primitive2d nOversampleValue ? nRasterHeight * nOversampleValue : nRasterHeight); // check for parallel execution possibilities - static bool bMultithreadAllowed = true; // loplugin:constvars:ignore + // Skia does not like being touched from multiple threads + // at the same time, and methods like DefaultProcessor3D::impRenderBitmapTexturePrimitive3D + // are going to do that. + static bool bMultithreadAllowed = !SkiaHelper::isVCLSkiaEnabled(); // loplugin:constvars:ignore sal_Int32 nThreadCount(0); comphelper::ThreadPool& rThreadPool(comphelper::ThreadPool::getSharedOptimalPool());