diff --git a/.gitignore b/.gitignore
index 43e0504..81b1890 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,5 @@ build/
*.elf
*.exe
src/resources/filelist.h
+*.wbf
+out/
diff --git a/Makefile b/Makefile
index 86a4de4..1b18435 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ LIBS := -lgui -lfreetype -lgd -lpng -ljpeg -lz -lmad -lvorbisidec -logg -lbz2 -
# list of directories containing libraries, this must be the top level
# containing include and lib
#-------------------------------------------------------------------------------
-LIBDIRS := $(PORTLIBS) $(WUT_ROOT)
+LIBDIRS := $(PORTLIBS) $(WUT_ROOT) $(WUT_ROOT)/usr
#-------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
diff --git a/src/Application.cpp b/src/Application.cpp
index 27f04bd..1517ef5 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -25,6 +25,7 @@
#include "resources/Resources.h"
#include "gui/sounds/SoundHandler.hpp"
#include "system/memory.h"
+#include "system/AsyncDeleter.h"
#include "utils/logger.h"
Application *Application::applicationInstance = NULL;
diff --git a/src/game/Pipe.cpp b/src/game/Pipe.cpp
index afd2a64..063a0bc 100644
--- a/src/game/Pipe.cpp
+++ b/src/game/Pipe.cpp
@@ -14,6 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
****************************************************************************/
+#include
#include "Pipe.h"
#include "gui/GuiTrigger.h"
#include "gui/GuiController.h"
diff --git a/src/menu/MainWindow.cpp b/src/menu/MainWindow.cpp
index e162858..1a1e775 100644
--- a/src/menu/MainWindow.cpp
+++ b/src/menu/MainWindow.cpp
@@ -21,6 +21,7 @@
#include "utils/StringTools.h"
#include "utils/logger.h"
#include "resources/Resources.h"
+#include "system/AsyncDeleter.h"
MainWindow::MainWindow(int w, int h)
: width(w)
diff --git a/src/system/AsyncDeleter.cpp b/src/system/AsyncDeleter.cpp
index 196a1e0..420d272 100644
--- a/src/system/AsyncDeleter.cpp
+++ b/src/system/AsyncDeleter.cpp
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
****************************************************************************/
-#include
+#include "AsyncDeleter.h"
AsyncDeleter * AsyncDeleter::deleterInstance = NULL;
@@ -28,9 +28,8 @@ AsyncDeleter::~AsyncDeleter() {
}
void AsyncDeleter::triggerDeleteProcess(void) {
- if(!deleterInstance){
- return;
- }
+ if(!deleterInstance)
+ deleterInstance = new AsyncDeleter;
//! to trigger the event after GUI process is finished execution
//! this function is used to swap elements from one to next array
@@ -46,13 +45,14 @@ void AsyncDeleter::triggerDeleteProcess(void) {
}
void AsyncDeleter::executeThread(void) {
- while(!exitApplication || !realDeleteElements.empty()) {
- if(realDeleteElements.empty()) suspendThread();
+ while(!exitApplication) {
+ suspendThread();
+
//! delete elements that require post process deleting
//! because otherwise they would block or do invalid access on GUI thread
while(!realDeleteElements.empty()) {
deleteMutex.lock();
- AsyncDeleter::Element *element = realDeleteElements.front();
+ GuiElement *element = realDeleteElements.front();
realDeleteElements.pop();
deleteMutex.unlock();
diff --git a/src/system/AsyncDeleter.h b/src/system/AsyncDeleter.h
index fc5dfea..c28251b 100644
--- a/src/system/AsyncDeleter.h
+++ b/src/system/AsyncDeleter.h
@@ -18,16 +18,15 @@
#define _ASYNC_DELETER_H
#include
+#include
#include "CThread.h"
#include "CMutex.h"
class AsyncDeleter : public CThread {
public:
static void destroyInstance() {
- if(deleterInstance != NULL) {
- delete deleterInstance;
- deleterInstance = NULL;
- }
+ delete deleterInstance;
+ deleterInstance = NULL;
}
class Element {
@@ -36,27 +35,13 @@ public:
virtual ~Element() {}
};
- static void pushForDelete(AsyncDeleter::Element *e) {
- if(!deleterInstance) {
- deleterInstance = new AsyncDeleter();
- }
+ static void pushForDelete(GuiElement *e) {
+ if(!deleterInstance)
+ deleterInstance = new AsyncDeleter;
+
deleterInstance->deleteElements.push(e);
}
- static BOOL deleteListEmpty() {
- if(!deleterInstance) {
- return true;
- }
- return deleterInstance->deleteElements.empty();
- }
-
- static BOOL realListEmpty() {
- if(!deleterInstance) {
- return true;
- }
- return deleterInstance->realDeleteElements.empty();
- }
-
static void triggerDeleteProcess(void);
private:
@@ -67,9 +52,9 @@ private:
void executeThread(void);
- BOOL exitApplication;
- std::queue deleteElements;
- std::queue realDeleteElements;
+ bool exitApplication;
+ std::queue deleteElements;
+ std::queue realDeleteElements;
CMutex deleteMutex;
};