diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-12-11 00:07:02 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-11 00:07:02 +0000 |
commit | 347040cf84401601b0d5cbb1d76e4648d1c8a461 (patch) | |
tree | 55aaab9d50d252ad2ed6bc03f35bf42ebe0cec3e /include | |
parent | a349a9e71aecf93d7d6d7d3e0d93d3e06291a519 (diff) | |
parent | 740acf213c56c406132294790fa2fadd0380cfa7 (diff) | |
download | frameworks_base-347040cf84401601b0d5cbb1d76e4648d1c8a461.zip frameworks_base-347040cf84401601b0d5cbb1d76e4648d1c8a461.tar.gz frameworks_base-347040cf84401601b0d5cbb1d76e4648d1c8a461.tar.bz2 |
am 740acf21: am c7801877: Merge "Fix issue where non-resource attributes would cause obtainStyleAttributes to fail" into lmp-mr1-dev
* commit '740acf213c56c406132294790fa2fadd0380cfa7':
Fix issue where non-resource attributes would cause obtainStyleAttributes to fail
Diffstat (limited to 'include')
-rw-r--r-- | include/androidfw/AttributeFinder.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/androidfw/AttributeFinder.h b/include/androidfw/AttributeFinder.h index a0ffeb3..acf7056 100644 --- a/include/androidfw/AttributeFinder.h +++ b/include/androidfw/AttributeFinder.h @@ -64,6 +64,7 @@ private: void jumpToClosestAttribute(uint32_t packageId); void markCurrentPackageId(uint32_t packageId); + bool mFirstTime; Iterator mBegin; Iterator mEnd; Iterator mCurrent; @@ -81,7 +82,8 @@ private: template <typename Derived, typename Iterator> inline BackTrackingAttributeFinder<Derived, Iterator>::BackTrackingAttributeFinder(const Iterator& begin, const Iterator& end) - : mBegin(begin) + : mFirstTime(true) + , mBegin(begin) , mEnd(end) , mCurrent(begin) , mLargest(begin) @@ -145,8 +147,11 @@ Iterator BackTrackingAttributeFinder<Derived, Iterator>::find(uint32_t attr) { return mEnd; } - if (mCurrentAttr == 0) { - // One-time initialization. + if (mFirstTime) { + // One-time initialization. We do this here instead of the constructor + // because the derived class we access in getAttribute() may not be + // fully constructed. + mFirstTime = false; mCurrentAttr = static_cast<const Derived*>(this)->getAttribute(mBegin); mLastPackageId = getPackage(mCurrentAttr); markCurrentPackageId(mLastPackageId); |