2013.1202 -> 2014.1262 transition.to kills my application

Hi, 

for the upcoming iOS7 thingy, I updated my corona from build 1202 to the recent 1262 release. After the update i couldn’t experience any bigger problems except one thing. i have a small character in my game that is controlled by the physics engine. this character has a small effect when hes flying through the air. i have a small video to showcase this effect:

http://www.youtube.com/watch?v=HKy4BakaX3c

you can see it at around 24 seconds (the small colored catfaces trail)

this is the code that starts this effect.

[lua]

[…a function thats shoots the player…]

local flyEffect = function()
  if player then
    local xTorso = player.torso.x
    local yTorso = player.torso.y

    local effectImage = display.newImageRect(“images/player/flyEffect_” … math.random(1,8) … “.png”,15,15)
    effectImage.x = xTorso
    effectImage.y = yTorso
    effectImage.alpha = 1
    effectImage.trans = transition.to(effectImage, {time = 500, y = lastYTorso, x = lastXTorso, alpha = 0, onComplete = function() display.remove(effectImage) end})
    abstractLevel:insert(effectImage)
    player:toFront()
    lastXTorso = xTorso
    lastYTorso = yTorso

    toFrontStuff()
  end
end

player.flyEffectTimer = timer.performWithDelay(50, flyEffect, -1)
[/lua]

now with the new update as soon as the player is set into the world and does its thing, the game starts dropping in fps rapidly after 15-30 seconds. the fps are dropping up until the simulator or the application on the device stand still (0 fps - this is the time where the simulator also shuts down). the music on the real device is still playing!  this problem didn’t exist with the 2013.1202 build. As soon as i remove this line

[lua]

effectImage.trans = transition.to(effectImage, {time = 500, y = lastYTorso, x = lastXTorso, alpha = 0, onComplete = function() display.remove(effectImage) end})

[/lua]

the game works just fine without any problems. obviously the effect doesn’t make much sense without  my transition because the images stay on the screen and there is no animation. I would greatly appreciate any help you can provide.

cheers,

gritob

try calling the display.remove in timer.performWithDelay like

onComplete = function() timer.performWithDelay(1, function() display.remove(effectImage) end) end

i just tried this and it seems that this fixed the problem! i need to do some more testing but it looks very promising. an insanely big THANK YOU. is there actually a reason for doing it this way? should i always do it with this method?

Well I am not exactly sure why it worked before and why it doesn’t now it’s just common instance programing logic: Do not kill an instance in any of it’s events or before you are done with it. True you are doing this in onComplete of a transition but who is to say that the transition doesn’t try to do something else with the object after it’s called your onComplete function. Doing it in performWith delay let’s the transition finish what it’s doing and let the app finish the current frame and only after that call the remove of the display object.

try calling the display.remove in timer.performWithDelay like

onComplete = function() timer.performWithDelay(1, function() display.remove(effectImage) end) end

i just tried this and it seems that this fixed the problem! i need to do some more testing but it looks very promising. an insanely big THANK YOU. is there actually a reason for doing it this way? should i always do it with this method?

Well I am not exactly sure why it worked before and why it doesn’t now it’s just common instance programing logic: Do not kill an instance in any of it’s events or before you are done with it. True you are doing this in onComplete of a transition but who is to say that the transition doesn’t try to do something else with the object after it’s called your onComplete function. Doing it in performWith delay let’s the transition finish what it’s doing and let the app finish the current frame and only after that call the remove of the display object.