segmentation fault when closing with VST plugins open

Forums

Hi,

First off thanks for a great piece of software. I've noticed that the program segfaults on exit when VST plugins have their editor open, for example with the Aspect VST. It looks like this is because of multipe calls to closeEditor, the patch below appears to fix the problem, but I don't know if that is the "right" way to solve it.
Another weird exit-effect is that sometimes the program never exits, but gets stuck waiting on the qtractorAudioPeakFile::m_mutex, not sure what causes that...

--- qtractor-svn-update/src/qtractorVstPlugin.h	2014-07-31 06:48:58.231330252 +0200
+++ qtractor/src/qtractorVstPlugin.h	2014-08-04 18:46:03.576215203 +0200
@@ -172,6 +172,7 @@
 	// Parameter update method.
 	void updateParamValues(bool bUpdate);
 
+	bool closingEditor() { return m_closing_editor; }
 private:
 
 	// Instance variables.
@@ -183,6 +184,8 @@
 
 	// Our own editor widget (parent frame).
 	EditorWidget *m_pEditorWidget;
+
+	bool m_closing_editor;
 };
 
--- qtractor-svn-update/src/qtractorVstPlugin.cpp	2014-07-31 06:48:58.223330253 +0200
+++ qtractor/src/qtractorVstPlugin.cpp	2014-08-04 18:38:16.076226369 +0200
@@ -276,7 +276,7 @@
 
 		QWidget::closeEvent(pCloseEvent);
 
-		if (m_pVstPlugin)
+		if (m_pVstPlugin && !m_pVstPlugin->closingEditor())
 			m_pVstPlugin->closeEditor();
 	}
 
@@ -581,7 +581,7 @@
 qtractorVstPlugin::qtractorVstPlugin ( qtractorPluginList *pList,
 	qtractorVstPluginType *pVstType )
 	: qtractorPlugin(pList, pVstType), m_ppEffects(NULL),
-		m_ppIBuffer(NULL), m_ppOBuffer(NULL), m_pEditorWidget(NULL)
+		m_ppIBuffer(NULL), m_ppOBuffer(NULL), m_pEditorWidget(NULL), m_closing_editor(false)
 {
 #ifdef CONFIG_DEBUG
 	qDebug("qtractorVstPlugin[%p] filename=\"%s\" index=%lu typeHint=%d",
@@ -1005,6 +1005,7 @@
 // Close editor.
 void qtractorVstPlugin::closeEditor (void)
 {
+	m_closing_editor = true;
 	if (m_pEditorWidget == NULL)
 		return;
 
Permalink

patch applied, simplified and brainlessly re-styled :)

svn trunk r3962 aka. qtractor v0.6.2.3.

test && tell.
thanks

ps. re. program never exits, but gets stuck waiting on the qtractorAudioPeakFile::m_mutex... try getting rid of any .peak files out there; they might just be leftovers of previous crashes/segfaults.

byee

Permalink

That seems to solve the segfault, thanks!
Still gets stuck on the mutex while exiting sometimes, but that might be due to having an unreasonably large FLAC file open in the session (8 hours...), or maybe because of my hacked PulseAudio audioengine backend..I'll investigate a bit more.

Permalink

Found the cause of the exit delay, if the peak thread tries a setRunState(0) in its destructor while writing a peak file, the thread doesn't stop until it is done writing, which takes a while with my 8 hour file :o)

ok. nailed it.

please test whether svn trunk r3964 aka. qtractor v0.6.2.5, behaves any better on that regard.

cheers.

Permalink

Still seems to get stuck with this version..however it does exit immediately now if I add this dirty hack:

 while (m_bRunState && writePeakFile()) {
    m_mutex.unlock(); this->sleep(0); m_mutex.lock(); // give setRunState a chance to run
}

Thanks!

you're right of course--i've nailed it again by dropping the mutex-locker on setRunState() instead.

svn trunk r3966 aka. qtractor v0.6.2.7

please test && tell, again ;)
cheers

Add new comment

The content of this field is kept private and will not be shown publicly.

Markdown

  • Parses markdown and converts it to HTML.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id> <img src alt height width> <strike> <pre> <p> <br>
  • Lines and paragraphs break automatically.

Filtered HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <b> <i> <pre> <img src alt height width> <strike>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
File attachments
Unlimited number of files can be uploaded to this field.
2 MB limit.
Allowed types: jpg jpeg gif png txt doc docx xls xlsx pdf ppt pps odt ods odp zip gz bz2 xz patch diff wav ogg flac ogv mp4 qtz.
CAPTCHA
Enter the characters shown in the image.