File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -250,15 +250,23 @@ class Injector
250250
251251 public function destroyInstance ( instance : Dynamic ) : Void
252252 {
253- this ._managedObjects .remove ( instance );
253+ // #if php
254+ if ( this ._managedObjects .containsKey ( instance ) )
255+ {
256+ this ._managedObjects .remove ( instance );
257+ instance .__ap ();
258+ }
259+ /* #else
254260 try
255261 {
262+ this._managedObjects.remove( instance );
256263 instance.__ap();
257264 }
258265 catch ( e : Dynamic )
259266 {
260267
261268 }
269+ #end*/
262270 }
263271
264272 public function map <T >( type : Class <T >, name : String = ' ' ) : InjectionMapping <T >
Original file line number Diff line number Diff line change @@ -729,6 +729,10 @@ class InjectorTest implements IInjectorListener
729729 var target = new Clazz ();
730730 Assert .isFalse ( target .preDestroyCalled , " target.preDestroyCalled should be false" );
731731 this .injector .destroyInstance ( target );
732+ Assert .isFalse ( target .preDestroyCalled , " target.preDestroyCalled should be false" );
733+ this .injector .map ( Clazz ).toType ( Clazz );
734+ target = this .injector .getOrCreateNewInstance ( Clazz );
735+ this .injector .destroyInstance ( target );
732736 Assert .isTrue ( target .preDestroyCalled , " target.preDestroyCalled should be true" );
733737 }
734738
You can’t perform that action at this time.
0 commit comments