mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01:00
WINGs: Add functions to release application memory
This commit is contained in:
committed by
Carlos R. Mafra
parent
36c3f7edf4
commit
588e04dda7
@@ -642,9 +642,11 @@ WMRect wmkrect(int x, int y, unsigned int width, unsigned int height);
|
|||||||
/* ---[ WINGs/wapplication.c ]-------------------------------------------- */
|
/* ---[ WINGs/wapplication.c ]-------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void WMInitializeApplication(const char *applicationName, int *argc, char **argv);
|
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);
|
void WMSetResourcePath(const char *path);
|
||||||
|
|
||||||
/* don't free the returned string */
|
/* don't free the returned string */
|
||||||
|
|||||||
@@ -365,6 +365,8 @@ Bool W_HandleInputEvents(Bool waitForInput, int inputfd);
|
|||||||
|
|
||||||
void W_InitNotificationCenter(void);
|
void W_InitNotificationCenter(void);
|
||||||
|
|
||||||
|
void W_ReleaseNotificationCenter(void);
|
||||||
|
|
||||||
void W_FlushASAPNotificationQueue(void);
|
void W_FlushASAPNotificationQueue(void);
|
||||||
|
|
||||||
void W_FlushIdleNotificationQueue(void);
|
void W_FlushIdleNotificationQueue(void);
|
||||||
|
|||||||
@@ -94,6 +94,21 @@ void W_InitNotificationCenter(void)
|
|||||||
notificationCenter->observerTable = WMCreateHashTable(WMIntHashCallbacks);
|
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
|
void
|
||||||
WMAddNotificationObserver(WMNotificationObserverAction * observerAction,
|
WMAddNotificationObserver(WMNotificationObserverAction * observerAction,
|
||||||
void *observer, const char *name, void *object)
|
void *observer, const char *name, void *object)
|
||||||
|
|||||||
@@ -48,6 +48,21 @@ void WMInitializeApplication(const char *applicationName, int *argc, char **argv
|
|||||||
W_InitNotificationCenter();
|
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)
|
void WMSetResourcePath(const char *path)
|
||||||
{
|
{
|
||||||
if (WMApplication.resourcePath)
|
if (WMApplication.resourcePath)
|
||||||
|
|||||||
Reference in New Issue
Block a user