Opened on 01/18/2018 at 01:04:08 PM

Closed on 01/23/2018 at 03:46:15 PM

Last modified on 01/24/2018 at 09:49:31 AM

#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):

https://codereview.adblockplus.org/29674689/

Description

Environment

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.

Attachments (0)

Change History (5)

comment:1 Changed on 01/19/2018 at 03:14:17 PM by jwangenheim

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

comment:2 Changed on 01/19/2018 at 03:14:29 PM by jwangenheim

  • Owner set to jwangenheim

comment:3 Changed on 01/23/2018 at 03:43:36 PM by abpbot

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

comment:4 Changed on 01/23/2018 at 03:46:15 PM by jwangenheim

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

comment:5 Changed on 01/24/2018 at 09:49:31 AM by mario

  • Milestone set to Adblock-Plus-for-Samsung-Browser-1.1.3

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from jwangenheim.
 
Note: See TracTickets for help on using tickets.