summaryrefslogtreecommitdiff
path: root/muse2/muse/app.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-10-16 21:35:39 +0000
committerTim E. Real <termtech@rogers.com>2011-10-16 21:35:39 +0000
commita65f03f8cefc3e1d2e6b71ace15789fc63795275 (patch)
tree7d7138e88f4dbd6c1dba3a67618dccf37973888c /muse2/muse/app.cpp
parentb071fa342f72770346e36b3564c9c225d9af791f (diff)
Fixed crashes reloading songs having open editors. Previous memleak fixes
revealed some problems. Installed bool TopWin::deleting(). It is set true when closeEvent() is called in any self-deleting TopWins. Used it to make all such TopWins and their corresponding child canvasses ignore songChanged signals.
Diffstat (limited to 'muse2/muse/app.cpp')
-rw-r--r--muse2/muse/app.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 677743b3..50a766dc 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -1844,7 +1844,7 @@ void MusE::openInScoreEdit(MusEGui::ScoreEdit* destination, MusECore::PartList*
destination = new MusEGui::ScoreEdit(this, 0, _arranger->cursorValue());
destination->show();
toplevels.push_back(destination);
- connect(destination, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(destination, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
connect(destination, SIGNAL(name_changed()), arrangerView, SLOT(scoreNamingChanged()));
//connect(muse, SIGNAL(configChanged()), destination, SLOT(config_changed()));
//commented out by flo, because the ScoreEditor connects to all
@@ -1882,7 +1882,7 @@ void MusE::startPianoroll(MusECore::PartList* pl, bool showDefaultCtrls)
pianoroll->addCtrl();
pianoroll->show();
toplevels.push_back(pianoroll);
- connect(pianoroll, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(pianoroll, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
connect(MusEGlobal::muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged()));
updateWindowMenu();
}
@@ -1904,7 +1904,7 @@ void MusE::startListEditor(MusECore::PartList* pl)
MusEGui::ListEdit* listEditor = new MusEGui::ListEdit(pl);
listEditor->show();
toplevels.push_back(listEditor);
- connect(listEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(listEditor, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
connect(MusEGlobal::muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged()));
updateWindowMenu();
}
@@ -1918,7 +1918,7 @@ void MusE::startMasterEditor()
MusEGui::MasterEdit* masterEditor = new MusEGui::MasterEdit();
masterEditor->show();
toplevels.push_back(masterEditor);
- connect(masterEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(masterEditor, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
updateWindowMenu();
}
@@ -1931,7 +1931,7 @@ void MusE::startLMasterEditor()
MusEGui::LMaster* lmaster = new MusEGui::LMaster();
lmaster->show();
toplevels.push_back(lmaster);
- connect(lmaster, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(lmaster, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
connect(MusEGlobal::muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged()));
updateWindowMenu();
}
@@ -1955,7 +1955,7 @@ void MusE::startDrumEditor(MusECore::PartList* pl, bool showDefaultCtrls)
drumEditor->addCtrl();
drumEditor->show();
toplevels.push_back(drumEditor);
- connect(drumEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(drumEditor, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
connect(MusEGlobal::muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged()));
updateWindowMenu();
}
@@ -1980,7 +1980,7 @@ void MusE::startWaveEditor(MusECore::PartList* pl)
waveEditor->show();
connect(MusEGlobal::muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged()));
toplevels.push_back(waveEditor);
- connect(waveEditor, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(waveEditor, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
updateWindowMenu();
}
@@ -2038,7 +2038,7 @@ void MusE::startClipList(bool checked)
//clipListEdit = new ClipListEdit();
clipListEdit = new MusEGui::ClipListEdit(this);
toplevels.push_back(clipListEdit);
- connect(clipListEdit, SIGNAL(deleted(MusEGui::TopWin*)), SLOT(toplevelDeleted(MusEGui::TopWin*)));
+ connect(clipListEdit, SIGNAL(isDeleting(MusEGui::TopWin*)), SLOT(toplevelDeleting(MusEGui::TopWin*)));
}
clipListEdit->show();
viewCliplistAction->setChecked(checked);
@@ -2084,10 +2084,10 @@ void MusE::selectProject(QAction* act)
}
//---------------------------------------------------------
-// toplevelDeleted
+// toplevelDeleting
//---------------------------------------------------------
-void MusE::toplevelDeleted(MusEGui::TopWin* tl)
+void MusE::toplevelDeleting(MusEGui::TopWin* tl)
{
for (MusEGui::iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) {
if (*i == tl) {
@@ -2132,19 +2132,17 @@ void MusE::toplevelDeleted(MusEGui::TopWin* tl)
case MusEGui::TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning
break;
}
- toplevels.erase(i);
+ toplevels.erase(i);
if (mustUpdateScoreMenus)
arrangerView->updateScoreMenus();
updateWindowMenu();
return;
}
}
- printf("topLevelDeleted: top level %p not found\n", tl);
+ printf("topLevelDeleting: top level %p not found\n", tl);
//assert(false);
}
-
-
//---------------------------------------------------------
// kbAccel
//---------------------------------------------------------
@@ -2750,16 +2748,21 @@ again:
case MusEGui::TopWin::MASTER:
case MusEGui::TopWin::WAVE:
case MusEGui::TopWin::LMASTER:
- tl->close();
- goto again;
-
+ {
+ if(tl->isVisible()) // Don't keep trying to close, only if visible.
+ {
+ if(!tl->close())
+ printf("MusE::clearSong TopWin did not close!\n");
+ goto again;
+ }
+ }
case MusEGui::TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning
break;
}
}
- microSleep(100000);
+ microSleep(100000);
MusEGlobal::song->clear(true, clear_all);
- microSleep(100000);
+ microSleep(100000);
return false;
}