fix pixmap leak

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@82 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-09-30 17:47:03 +00:00
parent e74b80da50
commit 8ea2d4a50a
15 changed files with 9359 additions and 1256 deletions

View File

@@ -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);
}
}
}