mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 08:00:50 +00:00
fix memory unsafe
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@392 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
21
src/core.c
21
src/core.c
@@ -170,7 +170,8 @@ MwWidget MwVaListCreateWidget(MwClass widget_class, const char* name, MwWidget p
|
||||
}
|
||||
|
||||
static void MwFreeWidget(MwWidget handle) {
|
||||
int i;
|
||||
int i;
|
||||
MwWidget root = handle;
|
||||
|
||||
MwDispatch(handle, destroy);
|
||||
|
||||
@@ -178,6 +179,14 @@ static void MwFreeWidget(MwWidget handle) {
|
||||
MwFreeWidget(handle->children[i]);
|
||||
}
|
||||
|
||||
while(root->parent != NULL) root = root->parent;
|
||||
for(i = 0; i < arrlen(root->tick_list); i++) {
|
||||
if(handle == root->tick_list[i]) {
|
||||
arrdel(root->tick_list, i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
free(handle->name);
|
||||
|
||||
MwLLDestroy(handle->lowlevel);
|
||||
@@ -199,19 +208,9 @@ static void MwFreeWidget(MwWidget handle) {
|
||||
}
|
||||
|
||||
void MwDestroyWidget(MwWidget handle) {
|
||||
int i;
|
||||
MwWidget root = handle;
|
||||
if(handle->parent != NULL) {
|
||||
arrput(handle->parent->destroy_queue, handle);
|
||||
}
|
||||
|
||||
while(root->parent != NULL) root = root->parent;
|
||||
for(i = 0; i < arrlen(root->tick_list); i++) {
|
||||
if(handle == root->tick_list[i]) {
|
||||
arrdel(root->tick_list, i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MwStep(MwWidget handle) {
|
||||
|
||||
Reference in New Issue
Block a user