Jump to content

Release() causing crash


YouGroove
 Share

Recommended Posts

I corrected some project problem of someone else.

 

I tried to free some object in it's script using Release but it crashed.

Must Release() be called by some manager or parent entity, or can it be called by the entity scripts owner in it's script ?

 



function Script:stopbullet()
       self.bullActive = false  
       self.entity:Hide()
       --Makes crash
       --self.entity:Release()
end

Stop toying and make games

Link to comment
Share on other sites

Here is a simple map file.

Steps to test :

- create new project

- download and dezip file test1.zip somewhere , than put test1.map in map directory

- download and put turret.zip on your "Models" folder

- dezip turret.zip (you should have Models/turret containing models,scripts)

- run the level

 

It will fire bullets and will crash at some point.

If you remove the call to Release() in script Models/turret/bullet.lua , it won't crash after lot of bullets.

 

Crash version

function Script:stopbullet()
self.bullActive = false
self.entity:Hide()
self.entity:Release()
end

 

ok version

function Script:stopbullet()
self.bullActive = false
self.entity:Hide()
end

test1.zip

Stop toying and make games

Link to comment
Share on other sites

First, if you are using physics commands you do not need to modulate things by GetAppSpeed(). The physics simulator runs at a constant 60 hz and will take care of this for you. In fact, that is the reason your bullets are wobbling around strangely.

 

I found the cause of this and was able to fix it. It's not really crashing, just creating an infinite loop.

 

This will first be available on the beta branch in Steam.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...