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?
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
[email protected]
https://mail.kde.org/mailman/listinfo/calligra-devel

Reply via email to