From 9dae48e3992521f104cde7c916ed1fb5ee1ecb54 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Thu, 26 Aug 2010 10:20:01 -0700 Subject: Fix issue #2951784: Launcher crashes on startup Change-Id: I98aedacce9a7d6b8bc168f39ea5489b40dc0ec8d --- core/java/android/view/LayoutInflater.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index 322812738cc2..194c01357613 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -348,6 +348,7 @@ public abstract class LayoutInflater { public View inflate(XmlPullParser parser, ViewGroup root, boolean attachToRoot) { synchronized (mConstructorArgs) { final AttributeSet attrs = Xml.asAttributeSet(parser); + Context lastContext = (Context)mConstructorArgs[0]; mConstructorArgs[0] = mContext; View result = root; @@ -432,12 +433,12 @@ public abstract class LayoutInflater { + ": " + e.getMessage()); ex.initCause(e); throw ex; + } finally { + // Don't retain static reference on context. + mConstructorArgs[0] = lastContext; + mConstructorArgs[1] = null; } - // Told retain static reference on context. - mConstructorArgs[0] = null; - mConstructorArgs[1] = null; - return result; } } -- cgit v1.2.3-59-g8ed1b