From eaebe3cb84747e12534bec14c6e5f0990bce5840 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 25 Jul 2010 20:47:04 +0200 Subject: [PATCH] ZynAddSubFX: check whether QDomDocument::setContent() succeeded When saving settings in ZynAddSubFxInstrument::saveSettings() check whether the call to QDomDocument::setContent() succeeded. Otherwise LMMS crashes when calling QDomDocument::importNode() later due to a bug in QtXml. Fixes crash in the unlikely situation that transmission of XML data from the ZynAddSubFX plugin to LMMS somehow failed. --- plugins/zynaddsubfx/ZynAddSubFx.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/zynaddsubfx/ZynAddSubFx.cpp b/plugins/zynaddsubfx/ZynAddSubFx.cpp index 128cd7913..91186d1c4 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.cpp +++ b/plugins/zynaddsubfx/ZynAddSubFx.cpp @@ -158,9 +158,11 @@ void ZynAddSubFxInstrument::saveSettings( QDomDocument & _doc, m_pluginMutex.unlock(); QByteArray a = tf.readAll(); QDomDocument doc( "mydoc" ); - doc.setContent( a ); - QDomNode n = _doc.importNode( doc.documentElement(), true ); - _this.appendChild( n ); + if( doc.setContent( a ) ) + { + QDomNode n = _doc.importNode( doc.documentElement(), true ); + _this.appendChild( n ); + } } }