• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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