summaryrefslogtreecommitdiff
path: root/chart2/source/controller/main/CommandDispatchContainer.cxx
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2010-05-19 17:08:43 +0200
committerIngrid Halama <iha@openoffice.org>2010-05-19 17:08:43 +0200
commit5be9c917443fbf32d934ddf953fbba2e25e5d884 (patch)
tree4ef1f6ca2613b4e59bde9a1133a0b7248cef5ac3 /chart2/source/controller/main/CommandDispatchContainer.cxx
parentefa9d1559bd91572b9b7806f6387879db88fd669 (diff)
chart47: #i109770# #i110253# prevent null access on empty m_aModel and reduce assertions 'already disposed'
Diffstat (limited to 'chart2/source/controller/main/CommandDispatchContainer.cxx')
-rw-r--r--chart2/source/controller/main/CommandDispatchContainer.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/chart2/source/controller/main/CommandDispatchContainer.cxx b/chart2/source/controller/main/CommandDispatchContainer.cxx
index 3761d0c33ce0..e0d689340760 100644
--- a/chart2/source/controller/main/CommandDispatchContainer.cxx
+++ b/chart2/source/controller/main/CommandDispatchContainer.cxx
@@ -72,7 +72,7 @@ void CommandDispatchContainer::setModel(
m_aCachedDispatches.clear();
DisposeHelper::DisposeAllElements( m_aToBeDisposedDispatches );
m_aToBeDisposedDispatches.clear();
- m_xModel.set( xModel );
+ m_xModel = xModel;
}
// void CommandDispatchContainer::setUndoManager(
@@ -102,33 +102,33 @@ Reference< frame::XDispatch > CommandDispatchContainer::getDispatchForURL(
}
else
{
- if( rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" ))
- || rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Redo" )))
+ uno::Reference< frame::XModel > xModel( m_xModel );
+
+ if( xModel.is() && (rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Undo" ))
+ || rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Redo" ))) )
{
- CommandDispatch * pDispatch = new UndoCommandDispatch( m_xContext, m_xModel );
+ CommandDispatch * pDispatch = new UndoCommandDispatch( m_xContext, xModel );
xResult.set( pDispatch );
pDispatch->initialize();
m_aCachedDispatches[ C2U(".uno:Undo") ].set( xResult );
m_aCachedDispatches[ C2U(".uno:Redo") ].set( xResult );
m_aToBeDisposedDispatches.push_back( xResult );
}
- else if( rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Context" ))
- || rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ModifiedStatus" )))
+ else if( xModel.is() && (rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Context" ))
+ || rURL.Path.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ModifiedStatus" ))) )
{
- Reference< view::XSelectionSupplier > xSelSupp;
- if( m_xModel.is())
- xSelSupp.set( m_xModel->getCurrentController(), uno::UNO_QUERY );
- CommandDispatch * pDispatch = new StatusBarCommandDispatch( m_xContext, m_xModel, xSelSupp );
+ Reference< view::XSelectionSupplier > xSelSupp( xModel->getCurrentController(), uno::UNO_QUERY );
+ CommandDispatch * pDispatch = new StatusBarCommandDispatch( m_xContext, xModel, xSelSupp );
xResult.set( pDispatch );
pDispatch->initialize();
m_aCachedDispatches[ C2U(".uno:Context") ].set( xResult );
m_aCachedDispatches[ C2U(".uno:ModifiedStatus") ].set( xResult );
m_aToBeDisposedDispatches.push_back( xResult );
}
- else if( m_xModel.is() &&
+ else if( xModel.is() &&
(m_aContainerDocumentCommands.find( rURL.Path ) != m_aContainerDocumentCommands.end()) )
{
- xResult.set( getContainerDispatchForURL( m_xModel->getCurrentController(), rURL ));
+ xResult.set( getContainerDispatchForURL( xModel->getCurrentController(), rURL ));
// ToDo: can those dispatches be cached?
m_aCachedDispatches[ rURL.Complete ].set( xResult );
}