summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-24 17:16:22 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-24 20:02:37 +0300
commit22e4c80cc35e552ef39639a874f3c54f11fde747 (patch)
tree01daf65c47092d228127588ffbcb0e63b128f01a /src
parent1e54255d9578e00ed699a458d9772f1035564620 (diff)
downloadplus-22e4c80cc35e552ef39639a874f3c54f11fde747.tar.gz
plus-22e4c80cc35e552ef39639a874f3c54f11fde747.tar.bz2
plus-22e4c80cc35e552ef39639a874f3c54f11fde747.tar.xz
plus-22e4c80cc35e552ef39639a874f3c54f11fde747.zip
Fix for race conditions in application termination.
This bug mostly visible in windows.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp3
-rw-r--r--src/soundmanager.cpp4
-rw-r--r--src/soundmanager.h2
-rw-r--r--src/touchmanager.cpp6
-rw-r--r--src/touchmanager.h2
5 files changed, 16 insertions, 1 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 85a224b41..8180b22c1 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -809,6 +809,9 @@ void Client::gameClear()
if (logger)
logger->log1("Quitting10");
+ sound.shutdown();
+ touchManager.shutdown();
+
#ifdef DEBUG_CONFIG
config.enableKeyLogging();
#endif
diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp
index d1a6a5d74..7ab66110a 100644
--- a/src/soundmanager.cpp
+++ b/src/soundmanager.cpp
@@ -66,6 +66,10 @@ SoundManager::SoundManager():
SoundManager::~SoundManager()
{
+}
+
+void SoundManager::shutdown()
+{
config.removeListeners(this);
// Unlink the callback function.
diff --git a/src/soundmanager.h b/src/soundmanager.h
index 4ea36c27e..d36cad92b 100644
--- a/src/soundmanager.h
+++ b/src/soundmanager.h
@@ -145,6 +145,8 @@ class SoundManager final : public ConfigListener
*/
void logic();
+ void shutdown();
+
private:
/** Logs various info about sound device. */
void info() const;
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index 313337259..3dd9e64a9 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -54,12 +54,16 @@ TouchManager::TouchManager() :
TouchManager::~TouchManager()
{
- config.removeListeners(this);
clear();
delete mVertexes;
mVertexes = nullptr;
}
+void TouchManager::shutdown()
+{
+ config.removeListeners(this);
+}
+
void TouchManager::init()
{
config.addListener("showScreenJoystick", this);
diff --git a/src/touchmanager.h b/src/touchmanager.h
index c9f018b7f..05b062074 100644
--- a/src/touchmanager.h
+++ b/src/touchmanager.h
@@ -142,6 +142,8 @@ class TouchManager final : public ConfigListener
void setTempHide(bool b);
+ void shutdown();
+
private:
TouchItem *mKeyboard;
TouchItem *mPad;