From: David Maciejak <david.macie...@gmail.com>

---
 WINGs/WINGs/WINGs.h  |  4 +++-
 WINGs/WINGs/WINGsP.h |  2 ++
 WINGs/notification.c | 15 +++++++++++++++
 WINGs/wapplication.c | 15 +++++++++++++++
 4 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/WINGs/WINGs/WINGs.h b/WINGs/WINGs/WINGs.h
index 3004d2d..dd3fac5 100644
--- a/WINGs/WINGs/WINGs.h
+++ b/WINGs/WINGs/WINGs.h
@@ -642,9 +642,11 @@ WMRect wmkrect(int x, int y, unsigned int width, unsigned 
int height);
 /* ---[ WINGs/wapplication.c ]-------------------------------------------- */
 
 
-
 void WMInitializeApplication(const char *applicationName, int *argc, char 
**argv);
 
+/* You're supposed to call this funtion before exiting so WINGs can terminate 
properly */
+void WMReleaseApplication(void);
+
 void WMSetResourcePath(const char *path);
 
 /* don't free the returned string */
diff --git a/WINGs/WINGs/WINGsP.h b/WINGs/WINGs/WINGsP.h
index de01412..5a6e612 100644
--- a/WINGs/WINGs/WINGsP.h
+++ b/WINGs/WINGs/WINGsP.h
@@ -365,6 +365,8 @@ Bool W_HandleInputEvents(Bool waitForInput, int inputfd);
 
 void W_InitNotificationCenter(void);
 
+void W_ReleaseNotificationCenter(void);
+
 void W_FlushASAPNotificationQueue(void);
 
 void W_FlushIdleNotificationQueue(void);
diff --git a/WINGs/notification.c b/WINGs/notification.c
index ada942f..b1b3712 100644
--- a/WINGs/notification.c
+++ b/WINGs/notification.c
@@ -94,6 +94,21 @@ void W_InitNotificationCenter(void)
        notificationCenter->observerTable = 
WMCreateHashTable(WMIntHashCallbacks);
 }
 
+void W_ReleaseNotificationCenter(void)
+{
+       if (notificationCenter) {
+               if (notificationCenter->nameTable)
+                       WMFreeHashTable(notificationCenter->nameTable);
+               if (notificationCenter->objectTable)
+                       WMFreeHashTable(notificationCenter->objectTable);
+               if (notificationCenter->observerTable)
+                       WMFreeHashTable(notificationCenter->observerTable);
+
+               wfree(notificationCenter);
+               notificationCenter = NULL;
+       }
+}
+
 void
 WMAddNotificationObserver(WMNotificationObserverAction * observerAction,
                          void *observer, const char *name, void *object)
diff --git a/WINGs/wapplication.c b/WINGs/wapplication.c
index a0aec2e..beca03d 100644
--- a/WINGs/wapplication.c
+++ b/WINGs/wapplication.c
@@ -48,6 +48,21 @@ void WMInitializeApplication(const char *applicationName, 
int *argc, char **argv
        W_InitNotificationCenter();
 }
 
+void WMReleaseApplication(void) {
+       int i;
+
+       W_ReleaseNotificationCenter();
+
+       if (WMApplication.applicationName)
+               wfree(WMApplication.applicationName);
+
+       for (i = 0; i < WMApplication.argc; i++)
+               wfree(WMApplication.argv[i]);
+
+       if (WMApplication.argv)
+               wfree(WMApplication.argv);
+}
+
 void WMSetResourcePath(const char *path)
 {
        if (WMApplication.resourcePath)
-- 
1.8.5.3


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to