Kaydet (Commit) 833567fa authored tarafından Markus Mohrhard's avatar Markus Mohrhard

don't pass uno interface implementation directly

Passing the implementation instead of an uno reference may result in
lifetime problems if the passed interface is distroyed while the second
one is still valid
see rhbz#579817 with memcheck
üst 0cb0952a
......@@ -67,7 +67,7 @@ class ScNamedRangeObj : public ::cppu::WeakImplHelper6<
public SfxListener
{
private:
ScNamedRangesObj* mpParent;
com::sun::star::uno::Reference< com::sun::star::sheet::XNamedRanges > mxParent;
ScDocShell* pDocShell;
String aName;
com::sun::star::uno::Reference< com::sun::star::container::XNamed > mxSheet;
......@@ -81,7 +81,7 @@ private:
SCTAB GetTab_Impl();
public:
ScNamedRangeObj(ScNamedRangesObj* pParent, ScDocShell* pDocSh, const String& rNm,
ScNamedRangeObj( com::sun::star::uno::Reference< com::sun::star::sheet::XNamedRanges > xParent, ScDocShell* pDocSh, const String& rNm,
com::sun::star::uno::Reference< com::sun::star::container::XNamed > xSheet = com::sun::star::uno::Reference< com::sun::star::container::XNamed > ());
virtual ~ScNamedRangeObj();
......
......@@ -99,8 +99,8 @@ bool lcl_UserVisibleName(const ScRangeData& rData)
return !rData.HasType(RT_DATABASE) && !rData.HasType(RT_SHARED);
}
ScNamedRangeObj::ScNamedRangeObj(ScNamedRangesObj* pParent, ScDocShell* pDocSh, const String& rNm, Reference<container::XNamed> xSheet):
mpParent(pParent),
ScNamedRangeObj::ScNamedRangeObj( Reference< sheet::XNamedRanges > xParent, ScDocShell* pDocSh, const String& rNm, Reference<container::XNamed> xSheet):
mxParent(xParent),
pDocShell( pDocSh ),
aName( rNm ),
mxSheet( xSheet )
......@@ -215,7 +215,7 @@ void ScNamedRangeObj::Modify_Impl( const String* pNewName, const ScTokenArray* p
if (pNewRanges->insert(pNew))
{
ScDocFunc aFunc(*pDocShell);
aFunc.SetNewRangeNames(pNewRanges, mpParent->IsModifyAndBroadcast(), nTab);
aFunc.SetNewRangeNames(pNewRanges, dynamic_cast<ScNamedRangesObj*>(mxParent.get())->IsModifyAndBroadcast(), nTab);
aName = aInsName; //! broadcast?
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment