Chromium Code Reviews| Index: base/android/java/src/org/chromium/base/library_loader/Linker.java |
| diff --git a/base/android/java/src/org/chromium/base/library_loader/Linker.java b/base/android/java/src/org/chromium/base/library_loader/Linker.java |
| index 54a672d7f166e9b625b736beef5ec6ae0ade6bdf..9bd536236835a8c567583096a5e36f2d3dd4b9b3 100644 |
| --- a/base/android/java/src/org/chromium/base/library_loader/Linker.java |
| +++ b/base/android/java/src/org/chromium/base/library_loader/Linker.java |
| @@ -474,15 +474,24 @@ public class Linker { |
| public static void useSharedRelros(Bundle bundle) { |
| // Ensure the bundle uses the application's class loader, not the framework |
| // one which doesn't know anything about LibInfo. |
| - if (bundle != null) |
| + // Also, hold a fresh copy of it so the caller can't recycle it. |
| + Bundle nullOrCopy = null; |
|
simonb (inactive)
2014/06/16 10:38:38
Perhaps a more descriptive variable name? clonedB
bulach
2014/06/16 21:54:55
Done.
|
| + if (bundle != null) { |
| + if (DEBUG) Log.i(TAG, "useSharedRelros() being DE-SER"); |
|
simonb (inactive)
2014/06/16 10:38:38
Old debugging trace? Message seems unhelpful with
bulach
2014/06/16 21:54:55
ops, my bad. deleted.
|
| bundle.setClassLoader(LibInfo.class.getClassLoader()); |
| + nullOrCopy = new Bundle(LibInfo.class.getClassLoader()); |
| + Parcel p = Parcel.obtain(); |
| + bundle.writeToParcel(p, 0); |
| + nullOrCopy.readFromParcel(p); |
| + p.recycle(); |
| + } |
| - if (DEBUG) Log.i(TAG, "useSharedRelros() called with " + bundle); |
| + if (DEBUG) Log.i(TAG, "useSharedRelros() called with " + nullOrCopy); |
|
simonb (inactive)
2014/06/16 10:38:38
No longer strictly accurate. Perhaps '... setting
bulach
2014/06/16 21:54:55
Done.
|
| synchronized (Linker.class) { |
| // Note that in certain cases, this can be called before |
| // initServiceProcess() in service processes. |
| - sSharedRelros = bundle; |
| + sSharedRelros = nullOrCopy; |
| // Tell any listener blocked in finishLibraryLoad() about it. |
| Linker.class.notifyAll(); |
| } |