]> git.sesse.net Git - mlt/commitdiff
Fix crash in Kdenlive title producer (kdenlive-2987)
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 22 Feb 2013 08:44:37 +0000 (09:44 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Fri, 22 Feb 2013 08:44:37 +0000 (09:44 +0100)
src/modules/qimage/kdenlivetitle_wrapper.cpp

index ccb320c7ab6ff291b01a8312cd4cb5a3d18a8f46..1f701f1b4c1bc6e31780360f9450007e7bef4864 100755 (executable)
@@ -48,6 +48,7 @@
 #endif
 
 static QApplication *app = NULL;
+Q_DECLARE_METATYPE(QTextCursor);
 
 class ImageItem: public QGraphicsItem
 {
@@ -197,8 +198,10 @@ void loadFromXml( mlt_producer producer, QGraphicsScene *scene, const char *temp
                                }
                                QGraphicsTextItem *txt = scene->addText(text, font);
                                if (txtProperties.namedItem("font-outline").nodeValue().toDouble()>0.0){
-                                       qRegisterMetaType<QTextCursor>( "QTextCursor" );
-                                       QTextCursor cursor(txt->document());
+                                       QTextDocument *doc = txt->document();
+                                       // Make sure some that the text item does not request refresh by itself
+                                       doc->blockSignals(true);
+                                       QTextCursor cursor(doc);
                                        cursor.select(QTextCursor::Document);
                                        QTextCharFormat format;
                                        format.setTextOutline(
@@ -401,6 +404,7 @@ void drawKdenliveTitle( producer_ktitle self, mlt_frame frame, int width, int he
                                        const char *localename = mlt_properties_get_lcnumeric( MLT_SERVICE_PROPERTIES( MLT_PRODUCER_SERVICE( producer ) ) );
                                        QLocale::setDefault( QLocale( localename ) );
                                }
+                               qRegisterMetaType<QTextCursor>( "QTextCursor" );
                        }
                        scene = new QGraphicsScene();
                        scene->setItemIndexMethod( QGraphicsScene::NoIndex );
@@ -442,7 +446,6 @@ void drawKdenliveTitle( producer_ktitle self, mlt_frame frame, int width, int he
                                    // the keystroke delay and a start offset, both in frames
                                    QStringList values = params.at( 2 ).split( ";" );
                                    int interval = qMax( 0, ( ( int ) position - values.at( 1 ).toInt()) / values.at( 0 ).toInt() );
-                                   qRegisterMetaType<QTextCursor>( "QTextCursor" );
                                    QTextCursor cursor = titem->textCursor();
                                    cursor.movePosition(QTextCursor::EndOfBlock);
                                    // get the font format