@@ -897,7 +897,7 @@ acgraph.vector.Stage.prototype.checkSize = function(opt_directCall, opt_silent)
897897 if ( ! opt_silent )
898898 this . dispatchEvent ( acgraph . vector . Stage . EventType . STAGE_RESIZE ) ;
899899 }
900- if ( this . container_ && isDynamicSize && ! goog . global [ 'isNodeJS' ] ) {
900+ if ( this . container_ && isDynamicSize && ! goog . global [ 'acgraph' ] [ ' isNodeJS'] ) {
901901 this . checkSizeTimer_ = setTimeout ( this . checkSize , this . maxResizeDelay_ ) ;
902902 }
903903} ;
@@ -1207,12 +1207,14 @@ acgraph.vector.Stage.prototype.finishRendering_ = function() {
12071207 var imageLoader = acgraph . getRenderer ( ) . getImageLoader ( ) ;
12081208 var isImageLoading = acgraph . getRenderer ( ) . isImageLoading ( ) ;
12091209 if ( imageLoader && isImageLoading ) {
1210- if ( ! this . imageLoadingListener_ )
1211- this . imageLoadingListener_ = goog . events . listenOnce ( imageLoader , goog . net . EventType . COMPLETE , function ( e ) {
1212- this . imageLoadingListener_ = null ;
1210+ if ( ! this . imageLoadingListener_ ) {
1211+ this . imageLoadingListener_ = true ;
1212+ goog . events . listenOnce ( imageLoader , goog . net . EventType . COMPLETE , function ( e ) {
1213+ this . imageLoadingListener_ = false ;
12131214 if ( ! this . isRendering_ )
12141215 this . dispatchEvent ( acgraph . vector . Stage . EventType . STAGE_RENDERED ) ;
12151216 } , false , this ) ;
1217+ }
12161218 } else {
12171219 this . dispatchEvent ( acgraph . vector . Stage . EventType . STAGE_RENDERED ) ;
12181220 }
@@ -2168,15 +2170,25 @@ acgraph.vector.Stage.prototype.dispose = function() {
21682170acgraph . vector . Stage . prototype . disposeInternal = function ( ) {
21692171 acgraph . vector . Stage . base ( this , 'disposeInternal' ) ;
21702172
2173+ goog . object . forEach ( this . charts , function ( value , key , arr ) {
2174+ value . remove ( ) ;
2175+ delete arr [ value ] ;
2176+ } ) ;
2177+
21712178 goog . dispose ( this . eventHandler_ ) ;
21722179 this . eventHandler_ = null ;
21732180
2181+ goog . dispose ( this . defs_ ) ;
2182+ delete this . defs_ ;
2183+
21742184 goog . dispose ( this . rootLayer_ ) ;
21752185 this . renderInternal ( ) ;
2186+
2187+ this . rootLayer_ . finalizeDisposing ( ) ;
21762188 delete this . rootLayer_ ;
21772189
2178- goog . dispose ( this . defs_ ) ;
2179- delete this . defs_ ;
2190+ var id = acgraph . utils . IdGenerator . getInstance ( ) . identify ( this , acgraph . utils . IdGenerator . ElementTypePrefix . STAGE ) ;
2191+ delete goog . global [ 'acgraph' ] . stages [ id ] ;
21802192
21812193 acgraph . unregister ( this ) ;
21822194
0 commit comments