Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Attached patch is a backport of commit
538190e0ea142d0a7da244809c66241379d4d91b
in master by Caolán McNamara.
The only change wrt to master is in whitespace in context lines (tabs
vs spaces...)

It fixes fdo#39950, "most annoying" and severity "critical": when
copy/pasting (or drag'n dropping across section boundaries) a control
in report builder, LibreOffice segfaults.

I've tested this patch on libreoffice-3-4 (and on master).

Please apply to libreoffice-3-4.

-- 
Lionel
From 28db081efcf00d14f4ae8c8b7e156af7521030f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Fri, 25 Nov 2011 20:16:36 +0000
Subject: [PATCH] Resolves: fdo#39950 fix dnd crash from default assignment
 operators

Signed-off-by: Lionel Elie Mamane <lionel@mamane.lu>
---
 reportdesign/inc/RptObject.hxx             |    4 ++
 reportdesign/source/core/sdr/RptObject.cxx |   58 ++++++++++++++++++----------
 2 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx
index d58950b..e24d51f 100644
--- a/reportdesign/inc/RptObject.hxx
+++ b/reportdesign/inc/RptObject.hxx
@@ -224,6 +224,8 @@ public:
     virtual OOle2Obj* Clone() const;
     virtual void initializeOle();
 
+    OOle2Obj& operator=(const OOle2Obj& rObj);
+
     void initializeChart( const ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XModel>& _xModel);
 };
 
@@ -275,6 +277,8 @@ public:
     virtual sal_uInt32 GetObjInventor() const;
     virtual OUnoObject* Clone() const;
 
+    OUnoObject& operator=(const OUnoObject& rObj);
+
 private:
     void    impl_setReportComponent_nothrow();
     void    impl_initializeModel_nothrow();
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 1f6a01a..80d56cb 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -941,18 +941,24 @@ uno::Reference< uno::XInterface > OUnoObject::getUnoShape()
 {
     return OObjectBase::getUnoShapeOf( *this );
 }
-// -----------------------------------------------------------------------------
+
+OUnoObject& OUnoObject::operator=(const OUnoObject& rObj)
+{
+    if( this == &rObj )
+        return *this;
+    SdrUnoObj::operator=(rObj);
+
+    Reference<XPropertySet> xSource(const_cast<OUnoObject&>(rObj).getUnoShape(), uno::UNO_QUERY);
+    Reference<XPropertySet> xDest(getUnoShape(), uno::UNO_QUERY);
+    if ( xSource.is() && xDest.is() )
+        comphelper::copyProperties(xSource.get(), xDest.get());
+
+    return *this;
+}
+
 OUnoObject* OUnoObject::Clone() const
 {
-    OUnoObject* pClone = CloneHelper< OUnoObject >();
-    if ( pClone )
-    {
-        Reference<XPropertySet> 
xSource(const_cast<OUnoObject*>(this)->getUnoShape(),uno::UNO_QUERY);
-        Reference<XPropertySet> xDest(pClone->getUnoShape(),uno::UNO_QUERY);
-        if ( xSource.is() && xDest.is() )
-            comphelper::copyProperties(xSource.get(),xDest.get());
-    }
-    return pClone;
+    return CloneHelper< OUnoObject >();
 }
 //----------------------------------------------------------------------------
 // OOle2Obj
@@ -1128,22 +1134,32 @@ uno::Reference< chart2::data::XDatabaseDataProvider > 
lcl_getDataProvider(const
     }
     return xSource;
 }
-// -----------------------------------------------------------------------------
-// Clone() soll eine komplette Kopie des Objektes erzeugen.
-OOle2Obj* OOle2Obj::Clone() const
+
+OOle2Obj& OOle2Obj::operator=(const OOle2Obj& rObj)
 {
-    OOle2Obj* pObj = CloneHelper< OOle2Obj >();
-    OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
-    svt::EmbeddedObjectRef::TryRunningState( pObj->GetObjRef() );
-    pObj->impl_createDataProvider_nothrow(pRptModel->getReportDefinition().get());
+    if( this == &rObj )
+        return *this;
+    SdrOle2Obj::operator=(rObj);
     
-    uno::Reference< chart2::data::XDatabaseDataProvider > xSource( 
lcl_getDataProvider(GetObjRef()) );
-    uno::Reference< chart2::data::XDatabaseDataProvider > xDest( 
lcl_getDataProvider(pObj->GetObjRef()) );
+    OReportModel* pRptModel = static_cast<OReportModel*>(rObj.GetModel());
+    svt::EmbeddedObjectRef::TryRunningState( GetObjRef() );
+    impl_createDataProvider_nothrow(pRptModel->getReportDefinition().get());
+
+    uno::Reference< chart2::data::XDatabaseDataProvider > xSource( 
lcl_getDataProvider(rObj.GetObjRef()) );
+    uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(GetObjRef()) 
);
     if ( xSource.is() && xDest.is() )
         comphelper::copyProperties(xSource.get(),xDest.get());
 
-    pObj->initializeChart(pRptModel->getReportDefinition().get());
-    return pObj;
+    initializeChart(pRptModel->getReportDefinition().get());
+
+    return *this;
+}
+
+// -----------------------------------------------------------------------------
+// Clone() soll eine komplette Kopie des Objektes erzeugen.
+OOle2Obj* OOle2Obj::Clone() const
+{
+    return CloneHelper< OOle2Obj >();
 }
 // -----------------------------------------------------------------------------
 void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel)
-- 
1.7.7.3


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.