Commented out debug messages.
[emufront] / src / dataobjects / emufrontfileobject.cpp
index d817bbf..5285885 100644 (file)
@@ -18,6 +18,7 @@
 // along with EmuFront.  If not, see <http://www.gnu.org/licenses/>.
 
 #include "emufrontfileobject.h"
+#include <QDebug>
 
 EmuFrontFileObject::EmuFrontFileObject()
     : EmuFrontObject(-1, ""), file(0) { }
@@ -25,16 +26,21 @@ EmuFrontFileObject::EmuFrontFileObject()
 EmuFrontFileObject::EmuFrontFileObject(int id, QString name, EmuFrontFile *file)
     : EmuFrontObject(id, name), file(file) {}
 
+EmuFrontFileObject::EmuFrontFileObject(int id, QString name)
+    : EmuFrontObject(id, name), file(0) {}
+
 EmuFrontFileObject::EmuFrontFileObject(const EmuFrontFileObject &pl)
-    : EmuFrontObject(pl.id, pl.name)
+    : EmuFrontObject(pl)
 {
     EmuFrontFile *f = pl.file;
-    file = new EmuFrontFile(*f);
+    file = f ? new EmuFrontFile(*f) : 0;
 }
 
 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 +48,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);