i construct each instance of the same sprite uses the same texturehandle. in the current plug I'm developing, if I have more than one object getting it's texture from the same handle, it crashes? any idea why? I'll try looking through the runtime code to figure out how sprite pulls it off, but any help would be appreciated.
I can't see why, but I'm fairly certain it's the problem. basically I have a line of code that copies the texture to a new handle each time a new object will use it. if i remove that code and make them both refer to the same handle it crashes
also, if it helps with the answer, the objects need to load an unknown amount of new textures off of disk at runtime, and share them amongst eachother
At what point does it crash? TextureHandles are reference counted, which is taken care of for you when creating a new textureHandle. But when manually setting a texture to an existing textureHandle it appears that you need to manually increment the reference.
thank you rojo
just recently changed something I can't seem to undo that made the problem worse. but when I debug.
it seems to set the textures fine one time, for a new object,
this is basically a modified sprite object that has localTex used for rendering instead of info.currenttexture
also I just added the line at the top to increment reference. Not sure if that's how it's supposed to be done
but it crashes on the highlighted line:
update. if I remove the line from the previous post it doesn't crash. but I really need to be able to generate a collision mask.
while I wait for a reply, I'll try to search for some releasecollision mask or increment of that. thanks for your help so far though
I'll post back if I figure it out before you do
edit: also removed the increment texture thing and works the same, no crash unless I try to generate a collision mask:
localTex = (TextureHandle)param;
this works fine with no crashes
There was a bug with GenerateCollisionMaskFromTexture() locking a texture region and not unlocking it. Is now in the SVN revision 283.
Develop games in your browser. Powerful, performant & highly capable.
thanks again. I pm'd you back about the updated runtimes. Also, if you could phrase what you did in a changelog friendly way I'll add it to the cc changelog