Bezet Posted May 18, 2016 Report Share Posted May 18, 2016 Hello, I'm not sure if its best place to report bug but couldn't find another. In gwinListAddItem function item counter is incremented but its never decremented, in my opinion it should be decremented in gwinListItemDelete. My proposition is to put gh2Obj->cnt--; in gwinListItemDelete function; Below are original functions bodys in 2.5 ugfx . void gwinListItemDelete(GHandle gh, int item) { const gfxQueueASyncItem * qi; int i; // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) return; // watch out for an invalid item if (item < 0 || item >= gh2obj->cnt) return; for(qi = gfxQueueASyncPeek(&gh2obj->list_head), i = 0; qi; qi = gfxQueueASyncNext(qi), i++) { if (i == item) { gfxQueueASyncRemove(&gh2obj->list_head, (gfxQueueASyncItem*)qi); gfxFree((void *)qi); if (gh2obj->top >= item && gh2obj->top) gh2obj->top--; _gwinUpdate(gh); break; } } } int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) { ListItem *newItem; // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) return -1; if (useAlloc) { size_t len = strlen(item_name)+1; if (!(newItem = gfxAlloc(sizeof(ListItem) + len))) return -1; memcpy((char *)(newItem+1), item_name, len); item_name = (const char *)(newItem+1); } else { if (!(newItem = gfxAlloc(sizeof(ListItem)))) return -1; } // the item is not selected when added newItem->flags = 0; newItem->param = 0; newItem->text = item_name; #if GWIN_NEED_LIST_IMAGES newItem->pimg = 0; #endif // select the item if it's the first in the list if (gh2obj->cnt == 0 && !(gh->flags & GLIST_FLG_MULTISELECT)) newItem->flags |= GLIST_FLG_SELECTED; // add the new item to the list gfxQueueASyncPut(&gh2obj->list_head, &newItem->q_item); // increment the total amount of entries in the list widget gh2obj->cnt++; _gwinUpdate(gh); // return the position in the list (-1 because we start with index 0) return gh2obj->cnt-1; } Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 18, 2016 Report Share Posted May 18, 2016 Thank you for bringing this to our attention! We will take a proper look at this during the following days and fix what needs to be fixed Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted May 21, 2016 Report Share Posted May 21, 2016 We just pushed a fix for this to the repository. Thank you for contribution! Link to comment Share on other sites More sharing options...
Bezet Posted May 22, 2016 Author Report Share Posted May 22, 2016 (edited) I'm glad I could help Edited May 22, 2016 by Bezet Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now