From 261b436f086d967d73fa196dd5378e8c8b04d20d Mon Sep 17 00:00:00 2001 From: Garrett Date: Mon, 20 Oct 2014 23:01:28 -0700 Subject: [PATCH] Fixed second instance no name Previously if you created a second instance of a certain GIG file, it would set the name to an empty string since it didn't create a new instance, only increased a reference count. Though, it still seg faults eventually when the reference count is greater than one. --- plugins/gig_player/gig_player.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/gig_player/gig_player.cpp b/plugins/gig_player/gig_player.cpp index 35246da6d..1d43bf7e3 100644 --- a/plugins/gig_player/gig_player.cpp +++ b/plugins/gig_player/gig_player.cpp @@ -200,8 +200,13 @@ void gigInstrument::freeInstance() if( m_instance->refCount <= 0 ) { s_instances.remove( m_filename ); + qDebug() << "gigInstrument: deleting instance of" << m_filename; delete m_instance; } + else + { + qDebug() << "gigInstrument: decreasing reference count for" << m_filename; + } s_instancesMutex.unlock(); m_instance = NULL; @@ -232,6 +237,8 @@ void gigInstrument::openFile( const QString & _gigFile, bool updateTrackName ) { m_instance = s_instances[ relativePath ]; m_instance->refCount++; + qDebug() << "gigInstrument: increasing reference count for" << relativePath; + succeeded = true; } // Add to map, if doesn't exist. @@ -243,6 +250,7 @@ void gigInstrument::openFile( const QString & _gigFile, bool updateTrackName ) m_instance = new gigInstance( _gigFile ); s_instances.insert( relativePath, m_instance ); succeeded = true; + qDebug() << "gigInstrument: adding instance of" << relativePath; } catch( ... ) {