Open toy-lin opened 7 years ago
Oh, i have found the problem.I thought Tray is thread safe but it's not. In my case ,method 'onCreate' was invoked twice from different thread. Am i wrong with my code?
Yes,Tray isn't thread safe.The lock to check version change is a TrayPreferences object, so if we create more than one TrayPreferences object in different thread , method 'onCreate' would probably be invoked more than 1 time. "synchronized void changeVersion(final int newVersion)"
Good finding. We will fix that
The same problem would happen in onCreate if multiple process start at the same time
Very thanks for your product,but i have got a NullPointerException while migrating data,can anybody give me some advice?
And below is code in CookiePreferences:
`public class CookiePreferences extends TrayPreferences { private static final String TAG = CookiePreferences.class.getSimpleName(); public static final String MODULE = "cookie"; private static final String SP_NAME = "mycookie"; public CookiePreferences(Context context) { super(context, MODULE, 1); }
}`
Version: