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:
committed by
Carlos R. Mafra
parent
9ee94f8777
commit
546c148ac0
@@ -62,14 +62,18 @@ void WMReleaseApplication(void) {
|
||||
|
||||
W_ReleaseNotificationCenter();
|
||||
|
||||
if (WMApplication.applicationName)
|
||||
if (WMApplication.applicationName) {
|
||||
wfree(WMApplication.applicationName);
|
||||
WMApplication.applicationName = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < WMApplication.argc; i++)
|
||||
wfree(WMApplication.argv[i]);
|
||||
if (WMApplication.argv) {
|
||||
for (i = 0; i < WMApplication.argc; i++)
|
||||
wfree(WMApplication.argv[i]);
|
||||
|
||||
if (WMApplication.argv)
|
||||
wfree(WMApplication.argv);
|
||||
WMApplication.argv = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void WMSetResourcePath(const char *path)
|
||||
|
||||
Reference in New Issue
Block a user