FELIX-5153: DM4 calls stop before ungetService() on ServiceFactory components.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1722429 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java b/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
index 2a9293b..3d7aefe 100644
--- a/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
+++ b/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/ComponentImpl.java
@@ -1308,7 +1308,7 @@
     private void unregisterService() {
         if (m_serviceName != null && m_registration != null) {
             try {
-                if (m_bundle != null && m_bundle.getState() == Bundle.ACTIVE) {
+                if (m_bundle != null && (m_bundle.getState() == Bundle.ACTIVE || m_bundle.getState() == Bundle.STOPPING)) {
                     m_registration.unregister();
                 }
             } catch (IllegalStateException e) { /* Should we really log this ? */}