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.
This commit is contained in:
Garrett
2014-10-20 23:01:28 -07:00
parent 85998a7b78
commit 261b436f08

View File

@@ -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( ... )
{