Skip to content

Commit

Permalink
Gallery: better dispose for gallery item renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Nov 10, 2012
1 parent 75c0935 commit aad02b7
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions Gallery/source/feathers/examples/gallery/GalleryItemRenderer.as
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ package feathers.examples.gallery
this.dispatchEventWith(starling.events.Event.CHANGE);
}

/**
* @private
*/
override public function dispose():void
{
if(this.image)
{
this.clearImage();
}
super.dispose();
}

/**
* @private
*/
Expand Down Expand Up @@ -243,9 +255,7 @@ package feathers.examples.gallery
}
if(this.image)
{
this.image.texture.dispose();
this.removeChild(this.image, true);
this.image = null;
this.clearImage();
}
this.currentImageURL = null;
}
Expand Down Expand Up @@ -301,6 +311,16 @@ package feathers.examples.gallery
return this.setSizeInternal(newWidth, newHeight, false);
}

/**
* @private
*/
protected function clearImage():void
{
this.image.texture.dispose();
this.removeChild(this.image, true);
this.image = null;
}

/**
* @private
*/
Expand Down

0 comments on commit aad02b7

Please sign in to comment.