From ddbb19cf510a8d7d288575876005ea12775ef7d2 Mon Sep 17 00:00:00 2001 From: "Tim E. Real" Date: Mon, 22 Nov 2010 08:19:49 +0000 Subject: Delete main MusE object before returning from main. Also make ClipList a child of it, so it deletes too. --- muse2/ChangeLog | 7 ++++++- muse2/muse/app.cpp | 22 ++++++++++++---------- muse2/muse/cliplist/cliplist.cpp | 11 ++++++++--- muse2/muse/cliplist/cliplist.h | 4 +++- muse2/muse/marker/markerview.cpp | 1 - 5 files changed, 29 insertions(+), 16 deletions(-) (limited to 'muse2') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index d4bfcafd..92f86eeb 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,6 +1,11 @@ -21.11.2010 +22.11.2010 - Oops, fixed regression, marker view and cliplist crashes, removed setAttribute(Qt::WA_DeleteOnClose) from TopWin constructor, and added it to individual TopWin sub-classes (only MidiEditor needs it). (Tim) + - Final major leak fixed: We can now delete the main MusE object just before returning from main! (Tim) + Now that markerview, cliplist et. al. are also being deleted (verified, dtors called), I changed + MusE::startClipList() so the main MusE instance owns it like all the others. It deletes too, now. + Also removed odd special Toplevel::CLIPLIST case in MusE::toplevelDeleted(). Hope it works... + Tested closing complex song, with all windows open. Nice to see final Finished! message (new, with -D). 21.11.2010 - All menus now use QActions. Some shortcuts are left to be assigned correctly (Orcan) - Clean up: Remove submenu integer ids from the MusE class in favor of QActions (Orcan) diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 502f97ef..f2c40020 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -3325,7 +3325,8 @@ void MusE::showDidYouKnowDialog() void MusE::startClipList(bool checked) { if (clipListEdit == 0) { - clipListEdit = new ClipListEdit(); + //clipListEdit = new ClipListEdit(); + clipListEdit = new ClipListEdit(this); toplevels.push_back(Toplevel(Toplevel::CLIPLIST, (unsigned long)(clipListEdit), clipListEdit)); connect(clipListEdit, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); } @@ -3384,8 +3385,9 @@ void MusE::toplevelDeleted(unsigned long tl) case Toplevel::CLIPLIST: // ORCAN: This needs to be verified. aid2 used to correspond to Cliplist: //menu_audio->setItemChecked(aid2, false); - viewCliplistAction->setChecked(false); - return; + ///viewCliplistAction->setChecked(false); // Don't think we require this any more. Tim. + ///return; + break; // the followin editors can exist in more than // one instantiation: case Toplevel::PIANO_ROLL: @@ -3918,13 +3920,13 @@ int main(int argc, char* argv[]) #endif /* HAVE_LASH */ QTimer::singleShot(100, muse, SLOT(showDidYouKnowDialog())); - return app.exec(); - // p3.3.47 - //int rv = app.exec(); - // FIXME: Can't do, seg fault at MarkerView::~MarkerView() - // due to already deleted undoRedo. - //delete muse; - //return rv; + int rv = app.exec(); + if(debugMsg) + printf("app.exec() returned:%d\nDeleting main MusE object\n", rv); + delete muse; + if(debugMsg) + printf("Finished! Exiting main, return value:%d\n", rv); + return rv; } diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp index 256a3f9c..9c67bd9d 100644 --- a/muse2/muse/cliplist/cliplist.cpp +++ b/muse2/muse/cliplist/cliplist.cpp @@ -98,11 +98,11 @@ QString ClipItem::text(int col) const // ClipListEdit //--------------------------------------------------------- -ClipListEdit::ClipListEdit() - : TopWin(0, "cliplist", Qt::Window) +ClipListEdit::ClipListEdit(QWidget* parent) + : TopWin(parent, "cliplist", Qt::Window) { //setAttribute(Qt::WA_DeleteOnClose); - setCaption(tr("MusE: Clip List Editor")); + setWindowTitle(tr("MusE: Clip List Editor")); editor = new ClipListEditorBaseWidget; setCentralWidget(editor); @@ -127,6 +127,11 @@ ClipListEdit::ClipListEdit() updateList(); } +ClipListEdit::~ClipListEdit() +{ + +} + //--------------------------------------------------------- // updateList //--------------------------------------------------------- diff --git a/muse2/muse/cliplist/cliplist.h b/muse2/muse/cliplist/cliplist.h index 156bc230..d440aec3 100644 --- a/muse2/muse/cliplist/cliplist.h +++ b/muse2/muse/cliplist/cliplist.h @@ -16,6 +16,7 @@ class QCloseEvent; class QDialog; +class QWidget; class QTreeWidgetItem; class Xml; @@ -56,7 +57,8 @@ class ClipListEdit : public TopWin { void deleted(unsigned long); public: - ClipListEdit(); + ClipListEdit(QWidget* parent); + ~ClipListEdit(); virtual void readStatus(Xml&); virtual void writeStatus(int, Xml&) const; }; diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp index 910d1cf3..f4959440 100644 --- a/muse2/muse/marker/markerview.cpp +++ b/muse2/muse/marker/markerview.cpp @@ -264,7 +264,6 @@ MarkerView::MarkerView(QWidget* parent) MarkerView::~MarkerView() { - // p3.3.47 //printf("MarkerView::~MarkerView() before undoRedo->removeFrom(tools)\n"); // undoRedo->removeFrom(tools); // p4.0.6 Removed -- cgit v1.2.3