Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#6289 closed defect (fixed)

Fix OnSharedPreferenceChangeListener

Reported by: jwangenheim Assignee: jwangenheim
Priority: P2 Milestone: Adblock-Plus-for-Samsung-Browser-1.1.3
Module: Adblock-Plus-for-Samsung-Browser Keywords:
Cc: diegocarloslima, mario Blocked By:
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):



ABP/SI version 1.1.2
Samsung Galaxy S6
Android 6.0.1

How to reproduce

  1. Install the debug version of ABP/SI
  2. Open the LogCat view in Android Studio
  3. Finish the initialization and enable ABP content blocker in Samsung Internet (use about:contentblock)
  4. Check/uncheck the AcceptableAds option

Observed behaviour

No preference change is logged

Expected behaviour

A preference change should be logged

SharedPreferences keeps listeners in a WeakHashMap. This means it will become the target of garbage collection as soon as you leave the current scope. It will work at first, but eventually, will get garbage collected, removed from the WeakHashMap and stop working.

We should keep a reference to the listener in a field of our MainPreferences class.

Change History (5)

comment:1 Changed 2 years ago by jwangenheim

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 2 years ago by jwangenheim

  • Owner set to jwangenheim

comment:3 Changed 2 years ago by abpbot

A commit referencing this issue has landed:
Issue 6289 - Fix OnSharedPreferenceChangeListener

comment:4 Changed 2 years ago by jwangenheim

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:5 Changed 2 years ago by mario

  • Milestone set to Adblock-Plus-for-Samsung-Browser-1.1.3
Note: See TracTickets for help on using tickets.