chart2/source/controller/main/ChartController_Properties.cxx | 20 ++++++----- 1 file changed, 11 insertions(+), 9 deletions(-)
New commits: commit cdee5a7b9773d58696a7a6daa643da2d0a57466d Author: Caolán McNamara <[email protected]> AuthorDate: Thu Dec 21 12:44:46 2023 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Dec 21 15:36:37 2023 +0100 crash when one user deletes a chart another has a property dialog open for Insert a chart, user #1 select it, user #2 select it. User #1 double click it, double click again the legend to get dialog to edit it. User #2 delete chart, User #1 'ok' #0 0x00007f5365797d59 in osl::Mutex::acquire (this=<optimized out>) at include/osl/mutex.hxx:63 #1 osl::ClearableGuard<osl::Mutex>::ClearableGuard (t=..., this=0x7ffc7ffcccf0) at include/osl/mutex.hxx:182 #2 apphelper::LifeTimeGuard::LifeTimeGuard (rManager=..., this=0x7ffc7ffcccf0) at chart2/source/inc/LifeTime.hxx:175 #3 chart::ChartModel::lockControllers (this=0x0) at chart2/source/model/main/ChartModel.cxx:415 #4 0x00007f53658375ab in chart::ControllerLockGuardUNO::ControllerLockGuardUNO (this=this@entry=0x7ffc7ffcce80, xModel=...) at chart2/source/tools/ControllerLockGuard.cxx:34 #5 0x00007f5364df5f34 in chart::ChartController::executeDlg_ObjectProperties_withoutUndoGuard (this=<optimized out>, rObjectCID=..., bSuccessOnUnchanged=<optimized out>) at chart2/source/controller/main/ChartController_Properties.cxx:797 #6 0x00007f5364df7a5e in chart::ChartController::executeDlg_ObjectProperties (this=0x7f535401f310, rSelectedObjectCID=...) at chart2/source/controller/main/ChartController_Properties.cxx:707 #7 0x00007f5364e0f497 in chart::ChartController::execute_MouseButtonUp (this=<optimized out>, rMEvt=...) at chart2/source/controller/main/ChartController_Window.cxx:924 #8 0x00007f53760d61dc in (anonymous namespace)::LOKPostAsyncEvent (pEv=0x55e2f1b93db0) at sfx2/source/view/lokhelper.cxx:893 #9 0x00007f53760d0977 in LokChartHelper::postMouseEvent (this=<optimized out>, nType=1, nX=<optimized out>, nY=<optimized out>, nCount=2, nButtons=1, nModifier=0, fScaleX=0.083333333333333329, fScaleY=0.083333333333333329) at sfx2/source/view/lokcharthelper.cxx:294 just hold a reference to the chart the dialog operates on Change-Id: I3b05d1fc12e4df899c1a996f1029f9d3d62e87ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161122 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 501870ecf2b2..6aedecc81ebc 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -736,8 +736,10 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( std::unique_ptr<ReferenceSizeProvider> pRefSizeProv(impl_createReferenceSizeProvider()); + rtl::Reference<::chart::ChartModel> xChartDoc(getChartModel()); + std::unique_ptr<wrapper::ItemConverter> pItemConverter( - createItemConverter( rObjectCID, getChartModel(), m_xCC, + createItemConverter( rObjectCID, xChartDoc, m_xCC, m_pDrawModelWrapper->getSdrModel(), comphelper::getFromUnoTunnel<ExplicitValueProvider>(m_xChartView), pRefSizeProv.get())); @@ -754,24 +756,24 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( //prepare dialog ObjectPropertiesDialogParameter aDialogParameter( rObjectCID ); - aDialogParameter.init( getChartModel() ); + aDialogParameter.init(xChartDoc); ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get() ); SolarMutexGuard aGuard; SchAttribTabDlg aDlg( GetChartFrame(), &aItemSet, &aDialogParameter, &aViewElementListProvider, - getChartModel() ); + xChartDoc ); if(aDialogParameter.HasSymbolProperties()) { uno::Reference< beans::XPropertySet > xObjectProperties = - ObjectIdentifier::getObjectPropertySet( rObjectCID, getChartModel() ); - wrapper::DataPointItemConverter aSymbolItemConverter( getChartModel(), m_xCC - , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( rObjectCID, getChartModel() ) + ObjectIdentifier::getObjectPropertySet( rObjectCID, xChartDoc ); + wrapper::DataPointItemConverter aSymbolItemConverter( xChartDoc, m_xCC + , xObjectProperties, ObjectIdentifier::getDataSeriesForCID( rObjectCID, xChartDoc ) , m_pDrawModelWrapper->getSdrModel().GetItemPool() , m_pDrawModelWrapper->getSdrModel() - , getChartModel() + , xChartDoc , wrapper::GraphicObjectType::FilledDataPoint ); SfxItemSet aSymbolShapeProperties(aSymbolItemConverter.CreateEmptyItemSet() ); @@ -785,7 +787,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( if( aDialogParameter.HasStatisticProperties() ) { aDlg.SetAxisMinorStepWidthForErrorBarDecimals( - InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getChartModel(), m_xChartView, rObjectCID ) ); + InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( xChartDoc, m_xChartView, rObjectCID ) ); } //open the dialog @@ -794,7 +796,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet(); if(pOutItemSet) { - ControllerLockGuardUNO aCLGuard( getChartModel()); + ControllerLockGuardUNO aCLGuard(xChartDoc); (void)pItemConverter->ApplyItemSet(*pOutItemSet); //model should be changed now bRet = true; }
