chart2/source/controller/main/ChartController_Properties.cxx | 20 ++++++----- 1 file changed, 11 insertions(+), 9 deletions(-)
New commits: commit 8ed865ffc151c6778f122b4e83b46a28f26ebe5e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Thu Dec 21 12:44:46 2023 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Dec 21 15:36:31 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/+/161099 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 9dccb435ebf0..84f1fdcb9e33 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -740,8 +740,10 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( ReferenceSizeProvider aRefSizeProv(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(), m_xChartView.get(), &aRefSizeProv)); @@ -758,24 +760,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() ); @@ -789,7 +791,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 @@ -798,7 +800,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; }