• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Does button array leak?

Status
Not open for further replies.
Level 11
Joined
Oct 11, 2012
Messages
711
I'm not sure what you mean. No memory is taken up until you actually create a handle through DialogAddButton. After that, you can use DialogClear() or DialogDestroy(), and I assume it would clear up the button handles.

Be sure to null the members of the arrays that were assigned to buttons, in order to prevent a reference leak.

Thanks, thats what I wanna know. LOL

Just as purge said i do not believe they leak if they are nulled.

Thank you also.
 
Level 11
Joined
Oct 11, 2012
Messages
711
I'm not sure what you mean. No memory is taken up until you actually create a handle through DialogAddButton. After that, you can use DialogClear() or DialogDestroy(), and I assume it would clear up the button handles.

Be sure to null the members of the arrays that were assigned to buttons, in order to prevent a reference leak.

What if I use global variables? (Edit: sorry, just realize I double posted.... )
JASS:
function Trig_npc_Actions takes nothing returns nothing
    call DisableTrigger(GetTriggeringTrigger())
    call TriggerSleepAction(1.)
    call EnableTrigger(gg_trg_npc1)
    call DialogClear(udg_dialog[8])
    set udg_button[10]=DialogAddButtonBJ(udg_dialog[8],"TRIGSTR_99996") 
    set udg_button[11]=DialogAddButtonBJ(udg_dialog[8],"TRIGSTR_99995") 
    set udg_button[12]=DialogAddButtonBJ(udg_dialog[8],"TRIGSTR_99994") 
    set udg_button[13]=DialogAddButtonBJ(udg_dialog[8],"TRIGSTR_99993") 
    call DialogSetMessage(udg_dialog[8],"TRIGSTR_99992")                      
    call DialogDisplayBJ(true,udg_dialog[8],GetOwningPlayer(GetEnteringUnit()))
endfunction

Please ignore BJs and inefficiency for the purpose of this post, I would like to know about leaking, LOL. Thanks
 
Status
Not open for further replies.
Top