diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-10-22 14:06:56 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-11-19 13:47:39 +0100 |
commit | 1ccab525dbb71ca26c0d280319ce4ff829be6ed6 (patch) | |
tree | f5a37bf47917a831b7f3f7e2f01fffdb9df097be /chart2 | |
parent | 7070318e0f8dd1ef0c1168e1280ab7636da7332a (diff) |
fix lifetime problems of ChartView
Change-Id: I99b24b026c50a05f8f3803348c76277e29a45ec7
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/inc/ChartModel.hxx | 1 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/main/DummyXShape.cxx | 3 |
3 files changed, 9 insertions, 3 deletions
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index e4cde2c46b33..c8f992a4267a 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -120,6 +120,7 @@ private: sal_Int32 m_nInLoad; sal_Bool volatile m_bUpdateNotificationsPending; + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xChartView; // for the ref count ChartView* mpChartView; OUString m_aResource; diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 3eedcfef875d..c29a10e7da6c 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -185,8 +185,6 @@ ChartModel::~ChartModel() OSL_TRACE( "ChartModel: DTOR called" ); if( m_xOldModelAgg.is()) m_xOldModelAgg->setDelegator( NULL ); - - delete mpChartView; } void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ ) @@ -1199,7 +1197,10 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString case SERVICE_MARKER_TABLE: { if(!mpChartView) + { mpChartView = new ChartView( m_xContext, *this); + xChartView = static_cast< ::cppu::OWeakObject* >( mpChartView ); + } return mpChartView->createInstance( rServiceSpecifier ); } break; @@ -1210,7 +1211,10 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString else if(rServiceSpecifier == CHART_VIEW_SERVICE_NAME) { if(!mpChartView) + { mpChartView = new ChartView( m_xContext, *this); + xChartView = static_cast< ::cppu::OWeakObject* >( mpChartView ); + } return static_cast< ::cppu::OWeakObject* >( mpChartView ); } diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 61860d01baed..0708ad8eb8e1 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -680,6 +680,7 @@ int oglErrorHandler( unx::Display* /*dpy*/, unx::XErrorEvent* /*evnt*/ ) bool DummyChart::initOpengl() { + initWindow(); mpWindow->setPosSizePixel(0,0,0,0); GLWin.Width = 0; GLWin.Height = 0; @@ -804,7 +805,7 @@ DummyChart::DummyChart(): void DummyChart::createGLContext() { - + initOpengl(); } void DummyChart::setPosition( const awt::Point& aPosition ) |