1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

WINGs: safer cleanup in the 'WMReleaseApplication' function

The function would not behave correctly if called twice, and the
library may re-use de-allocated pointers if calling WINGs functions
after calling this function.

The goal is for our library to behave as cleanly as possible, so
that users may have a clearer hint in case of misuse on their side
to debug the problem.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-09 21:29:08 +02:00
committed by Carlos R. Mafra
parent 9ee94f8777
commit 546c148ac0

View File

@@ -62,14 +62,18 @@ void WMReleaseApplication(void) {
W_ReleaseNotificationCenter(); W_ReleaseNotificationCenter();
if (WMApplication.applicationName) if (WMApplication.applicationName) {
wfree(WMApplication.applicationName); wfree(WMApplication.applicationName);
WMApplication.applicationName = NULL;
}
if (WMApplication.argv) {
for (i = 0; i < WMApplication.argc; i++) for (i = 0; i < WMApplication.argc; i++)
wfree(WMApplication.argv[i]); wfree(WMApplication.argv[i]);
if (WMApplication.argv)
wfree(WMApplication.argv); wfree(WMApplication.argv);
WMApplication.argv = NULL;
}
} }
void WMSetResourcePath(const char *path) void WMSetResourcePath(const char *path)