Fixed
Status Update
Comments
yb...@google.com <yb...@google.com>
da...@google.com <da...@google.com> #2
For a reproduction case:
1. Downloadhttps://github.com/romannurik/muzei
2. Checkout to room-issue-2.1.0-alpha03 tag
3. Change the ProviderDao to abstract suspend fun insert(provider: Provider)
4. Run the app, hit the Activate button
Expected Result: the image is loaded
Actual Result: the insert never returns (you only see a black screen), blocking the arch thread forever
1. Download
2. Checkout to room-issue-2.1.0-alpha03 tag
3. Change the ProviderDao to abstract suspend fun insert(provider: Provider)
4. Run the app, hit the Activate button
Expected Result: the image is loaded
Actual Result: the insert never returns (you only see a black screen), blocking the arch thread forever
Description
Version used:1.1.1
Devices/Android versions reproduced on: All
File: FrameworkSQLiteOpenHelper
OpenHelper(Context context, String name, final FrameworkSQLiteDatabase[] dbRef,
final Callback callback) {
super(context, name, null, callback.version,
new DatabaseErrorHandler() {
@Override
public void onCorruption(SQLiteDatabase dbObj) {
FrameworkSQLiteDatabase db = dbRef[0];
if (db != null) {
callback.onCorruption(db);
}
}
});
mCallback = callback;
mDbRef = dbRef;
}
callback.onCorruption(db) will never called when the db is corrupted, cause dbRef[0] always is null.
Maybe this code is better:
OpenHelper(Context context, String name, final FrameworkSQLiteDatabase[] dbRef,
final Callback callback) {
super(context, name, null, callback.version,
new DatabaseErrorHandler() {
@Override
public void onCorruption(SQLiteDatabase dbObj) {
FrameworkSQLiteDatabase db = dbRef[0];
callback.onCorruption(db != null ? db : new FrameworkSQLiteDatabase(dbObj));
}
});
mCallback = callback;
mDbRef = dbRef;
}