summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Deepanshu Gupta <deepanshu@google.com> 2014-05-02 19:19:52 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2014-05-02 19:19:52 +0000
commit27f0cf0b135917b52fea14406e806b35e721949e (patch)
tree3da6a2c568f4b0ddbfc3235e8845db21a9b490c9
parent5c7a844ca19873a03bac861ed021bdeea3712ca8 (diff)
parent10fd7f6b4192fdbd847106fb0d9ec87095092ee3 (diff)
am 10fd7f6b: am ca2c6307: am 87be67f9: Fix layoutlib [DO NOT MERGE]
* commit '10fd7f6b4192fdbd847106fb0d9ec87095092ee3': Fix layoutlib [DO NOT MERGE]
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
index 0963c2e1725f..5cb49d3b1dc0 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderAction.java
@@ -248,11 +248,16 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
* The counterpart is {@link #setUp()}.
*/
private void tearDown() {
- // Make sure to remove static references, otherwise we could not unload the lib
- mContext.disposeResources();
+ // The context may be null, if there was an error during init().
+ if (mContext != null) {
+ // Make sure to remove static references, otherwise we could not unload the lib
+ mContext.disposeResources();
+ }
- // quit HandlerThread created during this session.
- HandlerThread_Delegate.cleanUp(sCurrentContext);
+ if (sCurrentContext != null) {
+ // quit HandlerThread created during this session.
+ HandlerThread_Delegate.cleanUp(sCurrentContext);
+ }
// clear the stored ViewConfiguration since the map is per density and not per context.
ViewConfiguration_Accessor.clearConfigurations();
@@ -263,8 +268,12 @@ public abstract class RenderAction<T extends RenderParams> extends FrameworkReso
sCurrentContext = null;
Bridge.setLog(null);
- mContext.getRenderResources().setFrameworkResourceIdProvider(null);
- mContext.getRenderResources().setLogger(null);
+ if (mContext != null) {
+ mContext.getRenderResources().setFrameworkResourceIdProvider(null);
+ mContext.getRenderResources().setLogger(null);
+ }
+
+ mContext = null;
}
public static BridgeContext getCurrentContext() {