summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-12-18 03:01:21 +0000
committerTim E. Real <termtech@rogers.com>2010-12-18 03:01:21 +0000
commite7cc0ca7479cd4bca09963a1d843ecbae15898eb (patch)
tree63cac33dd793a0fb3e9e3de6ee5f01d24f47e682 /muse2
parent72dd531044077595601cfaae63835e49f46ece15 (diff)
Fixed marker view crash. Fixed some memory leaks.
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog4
-rw-r--r--muse2/muse/app.cpp54
-rw-r--r--muse2/muse/driver/jackmidi.cpp12
-rw-r--r--muse2/muse/dssihost.cpp23
-rw-r--r--muse2/muse/marker/markerview.cpp4
-rw-r--r--muse2/muse/song.cpp23
6 files changed, 77 insertions, 43 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 5ed9d7c4..700eeeb3 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,7 @@
+17.12.2010:
+ - Fixed crash with song loaded then File->New. Marker view had non-existent items from cleared marker list. (Tim)
+ - Some memory leak cleanups. Delete midiInstruments and midiDevices. (Tim)
+ TODO: Many more leaks to fix.
16.12.2010:
- Fixed track list track moving/resizing - added ev->buttons() check to mouseMoveEvent(). (Tim)
- Fixed meter drawing (speed) - removed double buffer pixmap. Test OK. (Tim)
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index e1a2f20c..5ea7c00d 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -1842,7 +1842,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
mixer2->move(config.mixer2.geometry.topLeft());
}
- showMarker(config.markerVisible);
+ //showMarker(config.markerVisible); // Moved below. Tim.
resize(config.geometryMain.size());
move(config.geometryMain.topLeft());
@@ -1864,30 +1864,34 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
// p3.3.53 Try this AFTER the song update above which does a mixer update... Tested OK - mixers resize properly now.
if (loadAll)
{
- if(mixer1)
- {
- if(mixer1->geometry().size() != config.mixer1.geometry.size())
- {
- //printf("MusE::loadProjectFile1 resizing mixer1 x:%d y:%d w:%d h:%d\n", config.mixer1.geometry.x(),
- // config.mixer1.geometry.y(),
- // config.mixer1.geometry.width(),
- // config.mixer1.geometry.height()
- // );
- mixer1->resize(config.mixer1.geometry.size());
- }
- }
- if(mixer2)
- {
- if(mixer2->geometry().size() != config.mixer2.geometry.size())
- {
- //printf("MusE::loadProjectFile1 resizing mixer2 x:%d y:%d w:%d h:%d\n", config.mixer2.geometry.x(),
- // config.mixer2.geometry.y(),
- // config.mixer2.geometry.width(),
- // config.mixer2.geometry.height()
- // );
- mixer2->resize(config.mixer2.geometry.size());
- }
- }
+ if(mixer1)
+ {
+ if(mixer1->geometry().size() != config.mixer1.geometry.size())
+ {
+ //printf("MusE::loadProjectFile1 resizing mixer1 x:%d y:%d w:%d h:%d\n", config.mixer1.geometry.x(),
+ // config.mixer1.geometry.y(),
+ // config.mixer1.geometry.width(),
+ // config.mixer1.geometry.height()
+ // );
+ mixer1->resize(config.mixer1.geometry.size());
+ }
+ }
+ if(mixer2)
+ {
+ if(mixer2->geometry().size() != config.mixer2.geometry.size())
+ {
+ //printf("MusE::loadProjectFile1 resizing mixer2 x:%d y:%d w:%d h:%d\n", config.mixer2.geometry.x(),
+ // config.mixer2.geometry.y(),
+ // config.mixer2.geometry.width(),
+ // config.mixer2.geometry.height()
+ // );
+ mixer2->resize(config.mixer2.geometry.size());
+ }
+ }
+
+ // Moved here from above due to crash with a song loaded and then File->New.
+ // Marker view list was not updated, had non-existent items from marker list (cleared in ::clear()).
+ showMarker(config.markerVisible);
}
}
diff --git a/muse2/muse/driver/jackmidi.cpp b/muse2/muse/driver/jackmidi.cpp
index 03c75ef4..d401c7e1 100644
--- a/muse2/muse/driver/jackmidi.cpp
+++ b/muse2/muse/driver/jackmidi.cpp
@@ -167,10 +167,14 @@ MidiJackDevice::~MidiJackDevice()
//if(_client_jackport)
// audioDevice->unregisterPort(_client_jackport);
// p3.3.55
- if(_in_client_jackport)
- audioDevice->unregisterPort(_in_client_jackport);
- if(_out_client_jackport)
- audioDevice->unregisterPort(_out_client_jackport);
+
+ if(audioDevice)
+ {
+ if(_in_client_jackport)
+ audioDevice->unregisterPort(_in_client_jackport);
+ if(_out_client_jackport)
+ audioDevice->unregisterPort(_out_client_jackport);
+ }
//close();
}
diff --git a/muse2/muse/dssihost.cpp b/muse2/muse/dssihost.cpp
index 8c967713..986abea1 100644
--- a/muse2/muse/dssihost.cpp
+++ b/muse2/muse/dssihost.cpp
@@ -332,9 +332,13 @@ static void scanDSSILib(QFileInfo& fi) // ddskrjo removed const for argument
}
else
{
- const DSSI_Descriptor* descr;
+ //const DSSI_Descriptor* descr;
for (int i = 0;; ++i)
{
+ const DSSI_Descriptor* descr;
+
+ // CRAPPY PLUGIN ALERT:
+ // Out of many plugins, with several, Valgrind says something in here is allocated with new.
descr = dssi(i);
if (descr == 0)
break;
@@ -594,14 +598,15 @@ SynthIF* DssiSynth::createSIF(SynthI* synti)
handle = 0;
return 0;
}
- for (int i = 0;; ++i) {
- dssi = df(i);
- if (dssi == 0)
- break;
- QString label(dssi->LADSPA_Plugin->Label);
- if (label == _name)
- break;
- }
+ for (int i = 0;; ++i)
+ {
+ dssi = df(i);
+ if (dssi == 0)
+ break;
+ QString label(dssi->LADSPA_Plugin->Label);
+ if (label == _name)
+ break;
+ }
if(dssi != 0)
{
diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp
index 80643b4d..d22807b6 100644
--- a/muse2/muse/marker/markerview.cpp
+++ b/muse2/muse/marker/markerview.cpp
@@ -430,7 +430,11 @@ void MarkerView::updateList()
selm = m;
}
+ // Block signals added. Triggers itemSelectionChanged() causing crash. Tim.
+ table->blockSignals(true);
table->clear();
+ table->blockSignals(false);
+
//MarkerList* marker = song->marker();
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp
index 3bd024d3..22506d3a 100644
--- a/muse2/muse/song.cpp
+++ b/muse2/muse/song.cpp
@@ -2175,10 +2175,10 @@ void Song::cleanupForQuit()
// Remove the controllers and the values.
midiPorts[i].controller()->clearDelete(true);
- // Can't do this here. Jack isn't running.
- /*
+ // Can't do this here. Jack isn't running. Fixed. Test OK so far.
+ #if 1
if(debugMsg)
- printf("deleting midi devices\n");
+ printf("deleting midi devices except synths\n");
for(iMidiDevice imd = midiDevices.begin(); imd != midiDevices.end(); ++imd)
{
// Since Syntis are midi devices, there's no need to delete them below.
@@ -2187,10 +2187,10 @@ void Song::cleanupForQuit()
delete (*imd);
}
midiDevices.clear(); // midi devices
- */
+ #endif
if(debugMsg)
- printf("deleting synths\n");
+ printf("deleting global available synths\n");
// Delete all synths.
std::vector<Synth*>::iterator is;
for(is = synthis.begin(); is != synthis.end(); ++is)
@@ -2202,6 +2202,19 @@ void Song::cleanupForQuit()
}
synthis.clear();
+ if(debugMsg)
+ printf("deleting midi instruments\n");
+ for(iMidiInstrument imi = midiInstruments.begin(); imi != midiInstruments.end(); ++imi)
+ {
+ // Since Syntis are midi instruments, there's no need to delete them below.
+ // Tricky, must cast as SynthI*.
+ SynthI* s = dynamic_cast <SynthI*> (*imi);
+ if(s)
+ continue;
+ delete (*imi);
+ }
+ midiInstruments.clear(); // midi devices
+
// Nothing required for ladspa plugin list, and rack instances of them
// are handled by ~AudioTrack.