Skip to content

Commit a734533

Browse files
antonisclaude
andcommitted
fix(feedback): clear stale activity ref and reset shake state on stop
- Clear currentActivity in onActivityDestroyed to prevent holding a stale reference to a destroyed activity context - Reset shakeCount and firstShakeTimestamp in stop() to prevent cross-session false triggers across pause/resume cycles Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a9ac3e1 commit a734533

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/FeedbackShakeIntegration.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public void onActivityDestroyed(final @NotNull Activity activity) {
105105
// outlive its host activity being destroyed.
106106
if (isDialogShowing && activity == currentActivity) {
107107
isDialogShowing = false;
108+
currentActivity = null;
108109
if (options != null) {
109110
options.getFeedbackOptions().setOnFormClose(previousOnFormClose);
110111
}

sentry-android-core/src/main/java/io/sentry/android/core/SentryShakeDetector.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public void start(final @NotNull Context context, final @NotNull Listener shakeL
9191

9292
public void stop() {
9393
listener = null;
94+
shakeCount = 0;
95+
firstShakeTimestamp = 0;
9496
if (sensorManager != null) {
9597
sensorManager.unregisterListener(this);
9698
}

0 commit comments

Comments
 (0)