From 2e901788519ca767ac705c7bfeb61816fbe970dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mikko=20Kein=C3=A4nen?= Date: Wed, 24 Nov 2010 23:32:54 +0200 Subject: [PATCH] Removed destructor from Platform since EmuFrontFileObject destructor does the destructing job properly already. --- src/dataobjects/emufrontfileobject.cpp | 7 +++++-- src/dataobjects/platform.cpp | 10 ---------- src/dataobjects/platform.h | 1 - testing/EmuFrontTesting/platformtest.cpp | 2 +- testing/EmuFrontTesting/platformtest.h | 3 +-- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/dataobjects/emufrontfileobject.cpp b/src/dataobjects/emufrontfileobject.cpp index c60c895..7928aac 100644 --- a/src/dataobjects/emufrontfileobject.cpp +++ b/src/dataobjects/emufrontfileobject.cpp @@ -18,6 +18,7 @@ // along with EmuFront. If not, see . #include "emufrontfileobject.h" +#include EmuFrontFileObject::EmuFrontFileObject() : EmuFrontObject(-1, ""), file(0) { } @@ -34,7 +35,9 @@ EmuFrontFileObject::EmuFrontFileObject(const EmuFrontFileObject &pl) EmuFrontFileObject::~EmuFrontFileObject() { - if (file) delete file; + qDebug() << "EmuFrontFileObject " << name << " dying"; + if (file) qDebug() << "File " << file->getName() << " will also be deleted."; + delete file; } EmuFrontFileObject& EmuFrontFileObject::operator =(const EmuFrontFileObject &ob) @@ -42,7 +45,7 @@ EmuFrontFileObject& EmuFrontFileObject::operator =(const EmuFrontFileObject &ob) if (this == &ob) return (*this); id = ob.id; name = ob.name; - if (file) delete file; + delete file; EmuFrontFile *f = ob.file; file = new EmuFrontFile(*f); return (*this); diff --git a/src/dataobjects/platform.cpp b/src/dataobjects/platform.cpp index 490a349..e0082d0 100644 --- a/src/dataobjects/platform.cpp +++ b/src/dataobjects/platform.cpp @@ -34,13 +34,3 @@ Platform::Platform(const Platform &p) : EmuFrontFileObject(p) { } - -Platform::~Platform() -{ - if (file) { - qDebug() << "file: " << file->getName(); - } - qDebug() << "Platform " << name << " @ " - << this << "dying."; -} - diff --git a/src/dataobjects/platform.h b/src/dataobjects/platform.h index 186946a..994e9b4 100644 --- a/src/dataobjects/platform.h +++ b/src/dataobjects/platform.h @@ -29,7 +29,6 @@ public: Platform(int id, QString name); Platform(int id, QString name, EmuFrontFile*); Platform(const Platform &); - ~Platform(); }; #endif // PLATFORM_H diff --git a/testing/EmuFrontTesting/platformtest.cpp b/testing/EmuFrontTesting/platformtest.cpp index 2a4d932..88324ad 100644 --- a/testing/EmuFrontTesting/platformtest.cpp +++ b/testing/EmuFrontTesting/platformtest.cpp @@ -82,7 +82,7 @@ void PlatformTest::equals2() // and pointer from p6 would keep pointing to memory area where // efA no longer exists: //Platform p6(1, "test", efA); - Platform p6(1, "test", efA); + Platform p6(1, "test", efB); qDebug() << "efA" << efA->getName(); qDebug() << "efB" << efB->getName(); diff --git a/testing/EmuFrontTesting/platformtest.h b/testing/EmuFrontTesting/platformtest.h index ed57e9c..1be331b 100644 --- a/testing/EmuFrontTesting/platformtest.h +++ b/testing/EmuFrontTesting/platformtest.h @@ -25,8 +25,7 @@ private slots: private: //EmuFrontFile *ef; /* - EmuFrontFile *efile; - */ + EmuFrontFile *efile;*/ //EmuFrontFile *efA; //EmuFrontFile *efB; -- 1.7.9.5