From: Mikko Keinänen Date: Wed, 17 Nov 2010 20:45:07 +0000 (+0200) Subject: Exceptions are instantiated in stack instead of heap. X-Git-Url: https://vcs.maemo.org/git/?p=emufront;a=commitdiff_plain;h=df46147595428b33d45a952c4577811289b6a917 Exceptions are instantiated in stack instead of heap. --- diff --git a/src/db/databasemanager.cpp b/src/db/databasemanager.cpp index b1e47db..5f33485 100644 --- a/src/db/databasemanager.cpp +++ b/src/db/databasemanager.cpp @@ -129,9 +129,8 @@ EmuFrontObject* DatabaseManager::getFilteredDataObject() if (sqlTableModel->rowCount() >= 1) { QSqlRecord record = sqlTableModel->record(0); - if (record.isEmpty()) - { - throw new EmuFrontException(tr("No filtered data available")); + if (record.isEmpty()) { + throw EmuFrontException(tr("No filtered data available")); } else plf = recordToDataObject(&record); } diff --git a/src/db/dbmediaimagecontainer.cpp b/src/db/dbmediaimagecontainer.cpp index e91edda..4ed6d10 100644 --- a/src/db/dbmediaimagecontainer.cpp +++ b/src/db/dbmediaimagecontainer.cpp @@ -48,7 +48,7 @@ int DbMediaImageContainer::storeMediaImageContainer(EmuFrontObject *efo) = dynamic_cast(efo); if (!mic->getFilePath()) - throw new EmuFrontException("Cannot install media image " + throw EmuFrontException("Cannot install media image " "container to database without a file path object!"); // multiple media image containers with matching checksum will be stored @@ -82,7 +82,7 @@ int DbMediaImageContainer::storeMediaImageContainer(EmuFrontObject *efo) // in the calling code block and clean // all the media image and ...containers from // the memory! - throw new EmuFrontException( + throw EmuFrontException( QString(tr("Inserting media image container %1 to file database failed")) .arg(mic->getName())); } @@ -91,7 +91,7 @@ int DbMediaImageContainer::storeMediaImageContainer(EmuFrontObject *efo) if (!linkMediaImageContainerToPath(mic)){ DbFile::deleteDataObject(fileId); - throw new EmuFrontException("Failed inserting media image to database!"); + throw EmuFrontException("Failed inserting media image to database!"); } //qDebug() << "Inserted media image container " << fileId << " to mediaimagecontainer table."; linkMediaImagesWithContainer(fileId, images.values()); @@ -224,7 +224,7 @@ void DbMediaImageContainer::linkMediaImagesWithContainer(int micId, QListgetId() << ", " << mi->getName() << ".";*/ if (!linkMediaImageToMediaImageContainer(mi, micId)) { - throw new EmuFrontException(QString("Failed linking media " + throw EmuFrontException(QString("Failed linking media " "image container %1 to a media image %2").arg(micId).arg(mi->getId())); } } diff --git a/src/dialogs/executableeditdialog.cpp b/src/dialogs/executableeditdialog.cpp index c62fe9f..4be8b01 100644 --- a/src/dialogs/executableeditdialog.cpp +++ b/src/dialogs/executableeditdialog.cpp @@ -83,19 +83,19 @@ void ExecutableEditDialog::acceptChanges() try { Setup *su = getSelectedSetup(); if (!su) { - throw new EmuFrontException(tr("Setup not selected")); + throw EmuFrontException(tr("Setup not selected")); } QString name = nameEdit->text().trimmed(); if (name.isEmpty()){ - throw new EmuFrontException(tr("Name is not set")); + throw EmuFrontException(tr("Name is not set")); } QString exec = execEdit->text().trimmed(); if (exec.isEmpty()){ - throw new EmuFrontException(tr("Executable is not set")); + throw EmuFrontException(tr("Executable is not set")); } QString opts = optEdit->text().trimmed(); if (opts.isEmpty()) { - throw new EmuFrontException(tr("Options not set")); + throw EmuFrontException(tr("Options not set")); } bool change = false; Setup *supTmp = ex->getSetup(); diff --git a/src/emulauncher.cpp b/src/emulauncher.cpp index c6403e9..f750963 100644 --- a/src/emulauncher.cpp +++ b/src/emulauncher.cpp @@ -167,7 +167,7 @@ void EmuLauncher::launchEmu() if (mame && listMIndex.count() > 1) { - throw new EmuFrontException(tr("No supported file types configured for this emulator configuration. " + throw EmuFrontException(tr("No supported file types configured for this emulator configuration. " "Assuming emulator support container files as is. " "Only one container can be selected without configuring supported file types." )); diff --git a/src/utils/fileutil.cpp b/src/utils/fileutil.cpp index f1a5f2d..ecc3b59 100644 --- a/src/utils/fileutil.cpp +++ b/src/utils/fileutil.cpp @@ -56,7 +56,7 @@ int FileUtil::scanFilePath(FilePathObject *fp, .arg(fp->getSetup()->getName())); } else if (!fp->getSetup()->getMediaType()){ - throw new EmuFrontException(tr("No media type available with %1.") + throw EmuFrontException(tr("No media type available with %1.") .arg(fp->getSetup()->getName())); } @@ -138,7 +138,7 @@ quint32 FileUtil::readCrc32(QString filePath) QFile file(filePath); //qDebug() << "readCrc32: " << filePath; if (!file.open(QIODevice::ReadOnly)) { - throw new EmuFrontException(QString(tr("Failed opening file %1 for reading the checksum!")).arg(filePath)); + throw EmuFrontException(QString(tr("Failed opening file %1 for reading the checksum!")).arg(filePath)); } quint32 crc = crc32(0L, Z_NULL, 0); int read = 0; @@ -147,7 +147,7 @@ quint32 FileUtil::readCrc32(QString filePath) } file.close(); if (crc <= 0) - throw new EmuFrontException(QString(tr("Failed reading crc checksum for file %1!")).arg(filePath)); + throw EmuFrontException(QString(tr("Failed reading crc checksum for file %1!")).arg(filePath)); //qDebug() << QString("readCrc32, crc: %1").arg(crc, 0, 16); return crc; } diff --git a/src/utils/unziphelper.cpp b/src/utils/unziphelper.cpp index af489a1..14b4bce 100644 --- a/src/utils/unziphelper.cpp +++ b/src/utils/unziphelper.cpp @@ -41,7 +41,7 @@ QMap UnzipHelper::listContents(const QString filePath, QFile fl(filePath); if (!fl.open(QIODevice::ReadOnly)) { - throw new EmuFrontException(tr("Couldn't read file %1.").arg(filePath)); + throw EmuFrontException(tr("Couldn't read file %1.").arg(filePath)); } //Setup *sup = fp->getSetup(); diff --git a/src/widgets/efcombobox.cpp b/src/widgets/efcombobox.cpp index 15769c0..d0a3d80 100644 --- a/src/widgets/efcombobox.cpp +++ b/src/widgets/efcombobox.cpp @@ -30,7 +30,7 @@ EFComboBox::EFComboBox(DatabaseManager *dbMan, QWidget *parent) : QComboBox(parent), dbManager(dbMan) { if (!dbManager) - throw new EmuFrontException("Database manager is not available!"); + throw EmuFrontException("Database manager is not available!"); setSizeAdjustPolicy(QComboBox::AdjustToContents); updateDataModel(); }