Invalidate and null system bundle context after shutdown. (FELIX-1288)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@789922 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index f0411b5..c18f3bf 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -4251,6 +4251,10 @@
             acquireBundleLock(Felix.this, Bundle.STOPPING);
             try
             {
+                // Clean up the bundle context.
+                ((BundleContextImpl) getBundleContext()).invalidate();
+                setBundleContext(null);
+
                 // Set the framework state to resolved and open
                 // the shutdown gate.
                 setBundleStateAndNotify(Felix.this, Bundle.RESOLVED);