Thread Tools Display Modes
09-04-08, 06:12 AM   #1
BDelacroix
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 33
CreateFrame() but no DestroyFrame()?

I have searched for this but haven't seen it. Is there a DestroyFrame() function? I believe in cleaning up the resources I allocate.

The reason I ask is that at some time I may need to destroy and recreate buttons (which we all know are really frames). To simply recreate buttons would be a memory leak.

I can work around it, but if a DestroyFrame() exists its easier.

Thank you.
  Reply With Quote
09-04-08, 06:19 AM   #2
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
There are (rather complicated) reasons DestroyFrame() does not exist.

Most people requiring dynamic creation will use a recycling scheme. There are also already libraries that will help you do this. It's a rather simple technique: make a pool of frames, and whenever you want to destroy them, put them back in the pool.
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
09-04-08, 06:22 AM   #3
BDelacroix
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 33
Ok, no destroy. I'll use the workaround. I want to stay away from external libraries as one of my goals is small neat code.

Thank you.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » CreateFrame() but no DestroyFrame()?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off