mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-03 16:10:50 +00:00
fix pixmap leak
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@82 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
14
src/core.c
14
src/core.c
@@ -57,10 +57,12 @@ MwWidget MwCreateWidget(MwClass widget_class, const char* name, MwWidget parent,
|
||||
sh_new_strdup(h->text);
|
||||
sh_new_strdup(h->integer);
|
||||
sh_new_strdup(h->handler);
|
||||
sh_new_strdup(h->data);
|
||||
|
||||
shdefault(h->integer, -1);
|
||||
shdefault(h->text, NULL);
|
||||
shdefault(h->handler, NULL);
|
||||
shdefault(h->data, NULL);
|
||||
|
||||
MwDispatch(h, create);
|
||||
|
||||
@@ -122,6 +124,7 @@ void MwDestroyWidget(MwWidget handle) {
|
||||
}
|
||||
shfree(handle->text);
|
||||
shfree(handle->handler);
|
||||
shfree(handle->data);
|
||||
|
||||
free(handle);
|
||||
}
|
||||
@@ -182,6 +185,10 @@ void MwSetText(MwWidget handle, const char* key, const char* value) {
|
||||
}
|
||||
}
|
||||
|
||||
void MwSetVoid(MwWidget handle, const char* key, void* value) {
|
||||
shput(handle->data, key, value);
|
||||
}
|
||||
|
||||
int MwGetInteger(MwWidget handle, const char* key) {
|
||||
if(strcmp(key, MwNx) == 0 || strcmp(key, MwNy) == 0 || strcmp(key, MwNwidth) == 0 || strcmp(key, MwNheight) == 0) {
|
||||
int x, y;
|
||||
@@ -203,6 +210,10 @@ const char* MwGetText(MwWidget handle, const char* key) {
|
||||
return shget(handle->text, key);
|
||||
}
|
||||
|
||||
void* MwGetVoid(MwWidget handle, const char* key) {
|
||||
return shget(handle->data, key);
|
||||
}
|
||||
|
||||
void MwVaApply(MwWidget handle, ...) {
|
||||
va_list va;
|
||||
|
||||
@@ -228,6 +239,9 @@ void MwVaListApply(MwWidget handle, va_list va) {
|
||||
shput(handle->handler, key, h);
|
||||
ind = shgeti(handle->handler, key);
|
||||
handle->handler[ind].user_data = NULL;
|
||||
} else if(key[0] == 'V') {
|
||||
void* v = va_arg(va, void*);
|
||||
MwSetVoid(handle, key, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user