FELIX-3681 discard dependency map when we discard the implementation object

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1390591 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
index 80cd8f0..f773a20 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/AbstractComponentManager.java
@@ -856,6 +856,11 @@
         return m_dependencies_map.compareAndSet( old, newDeps );
     }
 
+    protected void unsetDependencyMap()
+    {
+        m_dependencies_map.set( null );
+    }
+
     private void returnServices( Map deps )
     {
          for (Iterator it = deps.values().iterator(); it.hasNext(); )
@@ -1385,7 +1390,7 @@
                 {
                     acm.deleteComponent( reason );
                     acm.deactivateDependencyManagers();
-                    acm.m_dependencies_map.set( null );
+                    acm.unsetDependencyMap();
                 }
                 finally
                 {
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
index 543de5c..165ffbc 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ImmediateComponentManager.java
@@ -692,6 +692,7 @@
                         if ( m_useCount == 0 )
                         {
                             state().ungetService( this );
+                            unsetDependencyMap();
                         }
                     }
                     finally
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
index 2666249..0c39e39 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/manager/ServiceFactoryComponentManager.java
@@ -186,6 +186,7 @@
             if ( serviceContexts.isEmpty() && getState() == STATE_ACTIVE )
             {
                 changeState( Registered.getInstance() );
+                unsetDependencyMap();
             }
         }
         finally