FELIX-1488 dynamic binding must not be removed before initiating the
configuration deletion callback, otherwise the callback does not
take place.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@805678 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
index 9454ae6..d22214b 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
@@ -123,7 +123,6 @@
     {
         this.isDeleted = true;
         getPersistenceManager().delete( this.getPid() );
-        setDynamicBundleLocation( null );
         getConfigurationManager().deleted( this );
     }
 
diff --git a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
index 6d15ae8..1defa50 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationManager.java
@@ -1473,16 +1473,19 @@
     private class DeleteConfiguration implements Runnable
     {
 
-        private ConfigurationImpl config;
-        private String pid;
-        private String factoryPid;
+        private final String pid;
+        private final String factoryPid;
+        private final String configLocation;
 
 
         DeleteConfiguration( ConfigurationImpl config )
         {
-            this.config = config;
             this.pid = config.getPid();
             this.factoryPid = config.getFactoryPid();
+            this.configLocation = config.getBundleLocation();
+
+            // immediately unbind the configuration
+            config.setDynamicBundleLocation( null );
         }
 
 
@@ -1490,8 +1493,6 @@
         {
             try
             {
-                final String configLocation = config.getBundleLocation();
-
                 if ( factoryPid == null )
                 {
                     ServiceReference[] srList = bundleContext.getServiceReferences( ManagedService.class.getName(), "("