Skip to content

Commit

Permalink
Remove explicit file.close because QFile already handles this
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStevns committed Nov 29, 2024
1 parent 85b43e6 commit 685f96f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 23 deletions.
6 changes: 0 additions & 6 deletions core_lib/src/graphics/vector/vectorimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ bool VectorImage::read(QString filePath)
{
return false;
}
ScopeGuard fileScope([&] {
file.close();
});

QDomDocument doc;
if (!doc.setContent(&file)) return false; // this is not a XML file
Expand Down Expand Up @@ -127,9 +124,6 @@ Status VectorImage::write(QString filePath, QString format)
debugInfo << ("file.error() = " + file.errorString());
return Status(Status::FAIL, debugInfo);
}
ScopeGuard fileScope([&] {
file.close();
});

if (format != "VEC")
{
Expand Down
4 changes: 0 additions & 4 deletions core_lib/src/soundplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ void SoundPlayer::init(SoundClip* clip)

QFile file(clip->fileName());
file.open(QIODevice::ReadOnly);
ScopeGuard fileScope([&] {
file.close();
});


mBuffer.setData(file.readAll());
mBuffer.open(QBuffer::ReadOnly);
Expand Down
7 changes: 0 additions & 7 deletions core_lib/src/structure/filemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ Object* FileManager::load(const QString& sFileName)
handleOpenProjectError(Status::ERROR_FILE_CANNOT_OPEN, dd);
return nullptr;
}
ScopeGuard fileScope([&] {
file.close();
});

dd << "Main XML exists: Yes";

Expand Down Expand Up @@ -899,7 +896,6 @@ Status FileManager::recoverObject(Object* object)
xmlDoc.setContent(&file);
root = xmlDoc.documentElement();
objectTag = root.firstChildElement("object");
file.close();
}
loadPalette(object);

Expand Down Expand Up @@ -937,9 +933,6 @@ Status FileManager::rebuildMainXML(Object* object)
{
return Status::ERROR_FILE_CANNOT_OPEN;
}
ScopeGuard fileScope([&] {
file.close();
});

QDomDocument xmlDoc("PencilDocument");
QDomElement root = xmlDoc.createElement("document");
Expand Down
6 changes: 0 additions & 6 deletions core_lib/src/structure/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,6 @@ bool Object::exportPalette(const QString& filePath) const
qDebug("Error: cannot export palette");
return false;
}
ScopeGuard fileScope([&] {
file.close();
});

if (file.fileName().endsWith(".gpl", Qt::CaseInsensitive))
exportPaletteGPL(file);
Expand Down Expand Up @@ -667,9 +664,6 @@ bool Object::importPalette(const QString& filePath)
{
return false;
}
ScopeGuard fileScope([&] {
file.close();
});

if (file.fileName().endsWith(".gpl", Qt::CaseInsensitive))
{
Expand Down

0 comments on commit 685f96f

Please sign in to comment.