summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-02 02:55:29 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-02 02:55:29 +0300
commita70addadba0be1880bc55f13701034585aa19128 (patch)
tree5412e7844cc5a08532b82e4776b4bd3c9bff4818 /src
parent38846eb9dda3b1656a0b36acb2945edf7b314fa0 (diff)
downloadplus-a70addadba0be1880bc55f13701034585aa19128.tar.gz
plus-a70addadba0be1880bc55f13701034585aa19128.tar.bz2
plus-a70addadba0be1880bc55f13701034585aa19128.tar.xz
plus-a70addadba0be1880bc55f13701034585aa19128.zip
Fix possible leaks on exit and asserts about adding non existing zips and directories.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp3
-rw-r--r--src/dirs.cpp8
-rw-r--r--src/dyetool/client.cpp1
-rw-r--r--src/fs/physfs/virtfs.cpp11
-rw-r--r--src/fs/virtfs.h3
-rw-r--r--src/fs/virtfs/virtfs.cpp15
-rw-r--r--src/game.cpp1
-rw-r--r--src/gui/windows/updaterwindow.cpp2
8 files changed, 38 insertions, 6 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 51ad12106..4e9e7c74c 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -757,6 +757,7 @@ void Client::gameClear()
delete2(chatLogger);
TranslationManager::close();
+ VirtFs::deinit();
}
int Client::testsExec()
@@ -1095,7 +1096,7 @@ int Client::gameExec()
"/local/",
"zip");
- VirtFs::removeDirFromSearchPath(
+ VirtFs::removeDirFromSearchPathSilent(
settings.localDataDir +
dirSeparator +
settings.updatesDir +
diff --git a/src/dirs.cpp b/src/dirs.cpp
index 72d108388..052ba1dbb 100644
--- a/src/dirs.cpp
+++ b/src/dirs.cpp
@@ -189,9 +189,9 @@ void Dirs::extractDataDir()
void Dirs::mountDataDir()
{
- VirtFs::addDirToSearchPath(PKG_DATADIR "data/perserver/default",
+ VirtFs::addDirToSearchPathSilent(PKG_DATADIR "data/perserver/default",
Append_false);
- VirtFs::addDirToSearchPath("data/perserver/default",
+ VirtFs::addDirToSearchPathSilent("data/perserver/default",
Append_false);
#if defined __APPLE__
@@ -213,9 +213,9 @@ void Dirs::mountDataDir()
// mPackageDir = path;
#endif // defined __APPLE__
- VirtFs::addDirToSearchPath(PKG_DATADIR "data", Append_false);
+ VirtFs::addDirToSearchPathSilent(PKG_DATADIR "data", Append_false);
setPackageDir(PKG_DATADIR "data");
- VirtFs::addDirToSearchPath("data", Append_false);
+ VirtFs::addDirToSearchPathSilent("data", Append_false);
#ifdef ANDROID
#ifdef USE_SDL2
diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp
index a402fc6f9..73eb6d139 100644
--- a/src/dyetool/client.cpp
+++ b/src/dyetool/client.cpp
@@ -476,6 +476,7 @@ void Client::gameClear()
// delete2(chatLogger);
TranslationManager::close();
+ VirtFs::deinit();
}
#define ADDBUTTON(var, object) var = object; \
diff --git a/src/fs/physfs/virtfs.cpp b/src/fs/physfs/virtfs.cpp
index d19d112a3..9608dfd28 100644
--- a/src/fs/physfs/virtfs.cpp
+++ b/src/fs/physfs/virtfs.cpp
@@ -110,11 +110,22 @@ namespace VirtFs
return VirtFsPhys::addDirToSearchPath(newDir, append);
}
+ bool addDirToSearchPathSilent(const std::string &restrict newDir,
+ const Append append)
+ {
+ return VirtFsPhys::addDirToSearchPath(newDir, append);
+ }
+
bool removeDirFromSearchPath(const std::string &restrict oldDir)
{
return VirtFsPhys::removeDirFromSearchPath(oldDir);
}
+ bool removeDirFromSearchPathSilent(const std::string &restrict oldDir)
+ {
+ return VirtFsPhys::removeDirFromSearchPath(oldDir);
+ }
+
bool addZipToSearchPath(const std::string &restrict newDir,
const Append append)
{
diff --git a/src/fs/virtfs.h b/src/fs/virtfs.h
index 9a24ad8ba..f0876029d 100644
--- a/src/fs/virtfs.h
+++ b/src/fs/virtfs.h
@@ -48,7 +48,10 @@ namespace VirtFs
bool setWriteDir(const std::string &restrict newDir);
bool addDirToSearchPath(const std::string &restrict newDir,
const Append append);
+ bool addDirToSearchPathSilent(const std::string &restrict newDir,
+ const Append append);
bool removeDirFromSearchPath(const std::string &restrict oldDir);
+ bool removeDirFromSearchPathSilent(const std::string &restrict oldDir);
bool addZipToSearchPath(const std::string &restrict newDir,
const Append append);
bool removeZipFromSearchPath(const std::string &restrict oldDir);
diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp
index efa50922a..1069b8f7e 100644
--- a/src/fs/virtfs/virtfs.cpp
+++ b/src/fs/virtfs/virtfs.cpp
@@ -42,6 +42,7 @@ namespace VirtFs
void init(const std::string &restrict name)
{
VirtFsDir::init(name);
+ VirtFsZip::init();
updateDirSeparator();
}
@@ -155,6 +156,14 @@ namespace VirtFs
#endif // UNITTESTS
}
+ bool addDirToSearchPathSilent(const std::string &restrict newDir,
+ const Append append)
+ {
+ return VirtFsDir::addToSearchPathSilent(newDir,
+ append,
+ SkipError_false);
+ }
+
bool removeDirFromSearchPath(const std::string &restrict oldDir)
{
#ifdef UNITTESTS
@@ -164,6 +173,11 @@ namespace VirtFs
#endif // UNITTESTS
}
+ bool removeDirFromSearchPathSilent(const std::string &restrict oldDir)
+ {
+ return VirtFsDir::removeFromSearchPathSilent(oldDir);
+ }
+
bool addZipToSearchPath(const std::string &restrict newDir,
const Append append)
{
@@ -211,6 +225,7 @@ namespace VirtFs
bool deinit()
{
VirtFsDir::deinit();
+ VirtFsZip::deinit();
return true;
}
diff --git a/src/game.cpp b/src/game.cpp
index 9dcafad67..a96ded978 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -475,6 +475,7 @@ Game::~Game()
#endif // USE_MUMBLE
delete2(crazyMoves);
+ delete2(emptyBeingSlot);
Being::clearCache();
mInstance = nullptr;
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 192d55dc5..a8873e974 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -799,7 +799,7 @@ void UpdaterWindow::addUpdateFile(const std::string &restrict path,
if (!stat(fixFile.c_str(), &statbuf))
VirtFs::addZipToSearchPath(fixFile, append);
- if (append == Append_false)
+ if (append == Append_true)
VirtFs::addZipToSearchPath(tmpPath, append);
}