File tree Expand file tree Collapse file tree 2 files changed +15
-15
lines changed
sentry-android-core/src/main/java/io/sentry/android/core Expand file tree Collapse file tree 2 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ void reportANR(
144144 if (thread == null ) {
145145 error = new ApplicationNotResponding (message );
146146 } else {
147- error = new ApplicationNotResponding (message , anr . getThread () );
147+ error = new ApplicationNotResponding (message , thread );
148148 }
149149
150150 final Mechanism mechanism = new Mechanism ();
Original file line number Diff line number Diff line change @@ -95,24 +95,24 @@ public void close() throws IOException {
9595 }
9696
9797 final @ Nullable SentryAndroidOptions opts = options ;
98+ final @ Nullable AnrProfileManager pm ;
99+ try (final @ NotNull ISentryLifecycleToken ignored = profileManagerLock .acquire ()) {
100+ pm = profileManager ;
101+ profileManager = null ;
102+ }
98103 if (opts != null ) {
99104 try {
100105 opts .getExecutorService ()
101106 .submit (
102- new Runnable () {
103- @ Override
104- public void run () {
105- try (final @ NotNull ISentryLifecycleToken ignored =
106- profileManagerLock .acquire ()) {
107- if (profileManager != null ) {
108- //noinspection DataFlowIssue
109- profileManager .close ();
110- }
111- } catch (IOException e ) {
112- logger .log (SentryLevel .WARNING , "Failed to close AnrProfileManager" );
113- } finally {
114- profileManager = null ;
115- }
107+ () -> {
108+ if (pm == null ) {
109+ return ;
110+ }
111+
112+ try {
113+ pm .close ();
114+ } catch (IOException e ) {
115+ logger .log (SentryLevel .WARNING , "Failed to close AnrProfileManager" );
116116 }
117117 });
118118 } catch (Throwable e ) {
You can’t perform that action at this time.
0 commit comments