Record stacktraces for clones of closeable reference
@@ -33,7 +33,8 @@ public class DefaultCloseableReference<T> extends CloseableReference<T> {
@Override
public CloseableReference<T> clone() {
Preconditions.checkState(isValid());
- return new DefaultCloseableReference<T>(mSharedReference, mLeakHandler, mStacktrace);
+ return new DefaultCloseableReference<T>(
+ mSharedReference, mLeakHandler, mStacktrace != null ? new Throwable(mStacktrace) : null);
}
@Override
