• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Multiboard Set Item Leak?

Status
Not open for further replies.
Level 11
Joined
Jun 30, 2008
Messages
580
I have isolated that the MultiboardSetItemValue is causing my handles to go up, even though I destroy the multiboard later on, the handles stay the same. This function is called whenever a player presses the DOWN arrow key. And they will use it quite a bit x 10 players. And each press causes the handles to go up from 20 to 100 handles.

Is there a way around this?

JASS:
private function NextAtt takes nothing returns nothing
        local integer pID = GetPlayerId(GetTriggerPlayer())
        local CharDat dat = LoadInteger(CD, pID, 1)
        call MultiboardSetItemValue(MultiboardGetItem(dat.Instructions, dat.Attribute+2, 0), " ")
        call MultiboardReleaseItem(MultiboardGetItem(dat.Instructions, dat.Attribute+2, 0))
        if (dat.Attribute < MAXATT) then
            set dat.Attribute = dat.Attribute+1
        else
            set dat.Attribute = 1
        endif
        if (dat.Attribute==5) then
            if (dat.name == false) then
                set dat.name = true
            endif
        endif
        call MultiboardSetItemValue(MultiboardGetItem(dat.Instructions, dat.Attribute+2, 0), ARROW)
        call MultiboardReleaseItem(MultiboardGetItem(dat.Instructions, dat.Attribute+2, 0))
        set dat.name = false
    endfunction
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
You should just destroy it with MultiboardReleaseItem or recycle it. Do MultiboardGetItem once in the beginning for a cell and then store it globally or save it in a local variable til end of the function/thread to finally destroy it (do not forget to nullify the variable afterwards).
 
Level 11
Joined
Jun 30, 2008
Messages
580
This is what I got:
JASS:
    method setmbitem takes nothing returns nothing
        set .mbitem = MultiboardGetItem(.Instructions, 0, .Attribute+2)
    endmethod

And I call the method after the multiboard is created. It is still not working.
Also, the first thing I tried was a local variable and nulling it. And it still leaked.
(And yes I used
JASS:
MultiboardReleaseItem
)
 
Status
Not open for further replies.
Top