fix memleak

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@520 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-30 09:42:18 +00:00
parent 97db619e99
commit 07383f6c62
4 changed files with 19 additions and 1 deletions

View File

@@ -280,6 +280,13 @@ MWDECL void MwHideCursor(MwWidget handle);
*/
MWDECL void MwToggleDarkTheme(MwWidget handle, int toggle);
/*!
* @brief Gets the parent widget
* @param handle Widget
* @return Parent widget
*/
MWDECL MwWidget MwGetParent(MwWidget handle);
#ifdef __cplusplus
}
#endif

View File

@@ -588,3 +588,7 @@ void MwToggleDarkTheme(MwWidget handle, int toggle) {
force_render_all(handle);
}
}
MwWidget MwGetParent(MwWidget handle){
return handle->parent;
}

View File

@@ -121,6 +121,8 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color) {
pixmap = MwLLCreatePixmap(handle->lowlevel, data, rect->width / 4, rect->height);
MwLLDrawPixmap(handle->lowlevel, rect, pixmap);
MwLLDestroyPixmap(pixmap);
free(data);
}
void MwDrawFrame(MwWidget handle, MwRect* rect, MwLLColor color, int invert) {

View File

@@ -192,6 +192,8 @@ static void frame_draw(MwWidget handle) {
int i;
MwPoint p;
int st = 0;
int ent;
int area;
r.x = 0;
r.y = 0;
@@ -203,7 +205,10 @@ static void frame_draw(MwWidget handle) {
st = get_first_entry(handle->parent, lb);
for(i = st; i < arrlen(lb->list) && i < st + (r.height - MwGetDefaultBorderWidth(handle) * 2) / MwTextHeight(handle, "M"); i++) {
area = r.height - MwGetDefaultBorderWidth(handle) * 2;
ent = area / MwTextHeight(handle, "M");
for(i = st; i < arrlen(lb->list) && i < st + ent; i++) {
int selected = lb->selected == i ? 1 : 0;
int j;