Hi,

I found that sometimes kdenlive would crash on me and running under
gdb it seemed that it was because it was trying to set a property of a
filter where the "instance" member was zero.  I saw that the krender.c
code does not check whether filters are valid after it creates them,
so the attached patch seemed to help.

Please let me know if there's a different method for submitting
patches for this project, I couldn't see a process described on the
web site.


Steve
Index: kdenlive/krender.cpp
===================================================================
--- kdenlive/krender.cpp	(revision 2793)
+++ kdenlive/krender.cpp	(working copy)
@@ -86,9 +86,11 @@
 
     m_osdProfile = locate("data", "kdenlive/profiles/metadata.properties");
     m_osdInfo = new Mlt::Filter(*m_mltProfile, "data_show");
-    char *tmp = decodedString(m_osdProfile);
-    m_osdInfo->set("resource", tmp);
-    delete[] tmp;
+    if (m_osdInfo && m_osdInfo->is_valid()) {
+        char *tmp = decodedString(m_osdProfile);
+        m_osdInfo->set("resource", tmp);
+        delete[] tmp;
+    }
 
     m_mltConsumer = new Mlt::Consumer(*m_mltProfile, "sdl_preview");
     //m_mltConsumer = consumer;
@@ -656,10 +658,15 @@
 		mlt_producer_attach( m_mltProducer->get_producer(), filter );
 		mlt_filter_close( filter );
 
-    		m_osdInfo = new Mlt::Filter(*m_mltProfile, "data_show");
-		tmp = decodedString(m_osdProfile);
-    		m_osdInfo->set("resource", tmp);
-		delete[] tmp;
+        m_osdInfo = new Mlt::Filter(*m_mltProfile, "data_show");
+        if (!m_osdInfo || !m_osdInfo->is_valid()) {
+            kdError()<<"//////  setSceneList, data_show error //////"<<endl;
+            return;
+        }
+        tmp = decodedString(m_osdProfile);
+        m_osdInfo->set("resource", tmp);
+        delete[] tmp;
+
 		mlt_properties properties = MLT_PRODUCER_PROPERTIES(m_mltProducer->get_producer());
 		mlt_properties_set_int( properties, "meta.attr.timecode", 1);
 		mlt_properties_set( properties, "meta.attr.timecode.markup", "#timecode#");
@@ -1132,6 +1139,11 @@
     if (tag.startsWith("ladspa")) tag = "ladspa";
     char *filterId = decodedString(id);
     Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, filterId);
+    if (!filter->is_valid()) {
+    kdDebug()<<"**********  CANNOT CREATE FILTER "
+             <<filterId<<"-----------"<<endl;
+    return;
+    }
     filter->set("kdenlive_id", id);
 
     QMap<QString, QString>::Iterator it;
@@ -1146,7 +1158,12 @@
 	    if (currentKeyFrameNumber != keyFrameNumber) {
     		// attach filter to the clip
 		clipService.attach(*filter);
-	        filter = new Mlt::Filter(*m_mltProfile, filterId);
+        filter = new Mlt::Filter(*m_mltProfile, filterId);
+        if (!filter->is_valid()) {
+            kdDebug()<<"**********  CANNOT CREATE FILTER "
+                     <<filterId<<"-----------"<<endl;
+            return;
+        }
 		filter->set("kdenlive_id", id);
 		keyFrameNumber = currentKeyFrameNumber;
 	    }

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Kdenlive-devel mailing list
Kdenlive-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kdenlive-devel

Reply via email to