• 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.

Calling functions that return handles

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,342
Hi,

I was curious if when one calls a function that returns a handle, does that cause a leak, or does the game know to destroy that handle automatically (since it's not being stored in any variable outside the function because our function is preceded by a call)

Here is an example.

JASS:
function foo takes nothing returns rect
  return Rect(0.00, 0.00, 0.00, 0.00)
endfunction
...
call foo() //is there now a leaked rect handle in the map?
...
local rect r
set r = foo() //do I need it this way?
call RemoveRect(r)
set r = null
 
Status
Not open for further replies.
Top