Game Development Community

Datablock Removal - Reference Count Isn't Zero

by Joe Virgin · in iTorque 2D · 03/11/2010 (9:18 am) · 3 replies

In XCode, I keep receiving this message from the console:

t2dImageMapDatablock::onRemove() - Reference Count isn't zero but image-map is being destroyed! (2 ref)

I'm using a preLoader that removes existing datablocks (using datablock.delete()) before moving on to the next level. I'm assuming that the error comes about because there are objects on the scene that have not been deleted and are referencing a deleted datablock. Should I be concerned about this error?

About the author

Joe Virgin is a programmer for Plainvue Software, Inc., a company producing iPhone games that teach math skills to the youth. Check out Fraction's Kitchen Lite, Fortune's Prime, and Chainshooter powered by iTGB and now available on the App Store.


#1
06/10/2010 (2:33 am)
You must delete all objects into level FIRST...

this function help you.....

function _levelCleanup(%scenegraph){
    
	 if(isObject(%scenegraph)){	 
	  echo("##########******* CLEANUPLEVEL *******##########");  
		  %sceneObjectList = %scenegraph.getSceneObjectList();
		  for (%i = 0; %i < getWordCount(%sceneObjectList); %i++)
		  {
			 %sceneObject = getWord(%sceneObjectList, %i);
			 if(isObject(%sceneObject)){
			   echo("["@%i@"] object deleting: "@%sceneObject.getClassName());
			   %sceneObject.delete();			 
			 }   
		  }
	  echo("##########******* CLEANUPLEVEL END ****##########");
	  }	 
}
#2
06/22/2010 (4:58 pm)
This is interesting because I'm seeing the exact same thing (2 ref). I've been getting this message for ages, but I didn't pay attention to it. I will try your code.
#3
06/24/2010 (8:29 pm)
Just letting you know, I've added your function to my own project and it works great and solves my problem. Thanks for sharing your code.