[prev in list] [next in list] [prev in thread] [next in thread] 

List:       calligra-devel
Subject:    Review-request: Fix shapes are not deleted in KPresenter
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2011-04-20 21:37:01
Message-ID: 201104202337.02240.mail () dipe ! org
[Download RAW message or body]

Please see attached patch which fixes
Crash is observed while opening the attached ppt file
https://bugs.kde.org/show_bug.cgi?id=270960
and is the followup to the "deleting children of KoShapeContainer" thread.

ok to commit?

["KPresenterDeleteShapes.patch" (text/x-patch)]

diff --git a/kpresenter/part/KPrPicturesImport.cpp \
b/kpresenter/part/KPrPicturesImport.cpp index 765b803..5cd08c3 100644
--- a/kpresenter/part/KPrPicturesImport.cpp
+++ b/kpresenter/part/KPrPicturesImport.cpp
@@ -118,6 +118,7 @@ void KPrPicturesImport::pictureImported(KJob *job)
         }
         else {
             kWarning(33001) << "imageData not valid";
+            delete shape;
         }
     }
     else {
diff --git a/kpresenter/part/KPrPlaceholderTextStrategy.cpp \
b/kpresenter/part/KPrPlaceholderTextStrategy.cpp index fc94efc..a4091ab 100644
--- a/kpresenter/part/KPrPlaceholderTextStrategy.cpp
+++ b/kpresenter/part/KPrPlaceholderTextStrategy.cpp
@@ -125,6 +125,7 @@ bool KPrPlaceholderTextStrategy::loadOdf( const KoXmlElement & \
                element, KoShapeL
     if (KoTextSharedLoadingData *textSharedData = \
dynamic_cast<KoTextSharedLoadingData \
                *>(context.sharedData(KOTEXT_SHARED_LOADING_ID))) {
         KoShapeFactoryBase *factory = \
KoShapeRegistry::instance()->value("TextShapeID");  Q_ASSERT(factory);
+        delete m_textShape;
         m_textShape = \
factory->createDefaultShape(context.documentResourceManager());  
         KoTextShapeData *shapeData = \
qobject_cast<KoTextShapeData*>(m_textShape->userData()); @@ -166,6 +167,7 @@ void \
KPrPlaceholderTextStrategy::init(KoResourceManager *documentResources)  Q_ASSERT( \
factory );  KoProperties props;
     props.setProperty("text", text());
+    delete m_textShape;
     m_textShape = factory->createShape(&props, documentResources);
 }
 
diff --git a/libs/kopageapp/KoPAPageBase.cpp b/libs/kopageapp/KoPAPageBase.cpp
index 8cbdba6..6c65a95 100644
--- a/libs/kopageapp/KoPAPageBase.cpp
+++ b/libs/kopageapp/KoPAPageBase.cpp
@@ -52,6 +52,12 @@ KoPAPageBase::KoPAPageBase()
 
 KoPAPageBase::~KoPAPageBase()
 {
+    KoShapeLayer * layer = dynamic_cast<KoShapeLayer *>( shapes().first() );
+    if ( layer )
+    {
+        qDeleteAll( layer->shapes() );
+        delete layer;
+    }
 }
 
 void KoPAPageBase::paintComponent(QPainter& painter, const KoViewConverter& \
converter)



_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic