1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 02:55:50 +01:00

Fossil: Fix exception when support class is terminated

This commit is contained in:
José Rebelo 2024-07-19 12:58:41 +01:00 committed by Arjan Schrijver
parent 7fa5cd1be5
commit 7c9016b5a4
3 changed files with 17 additions and 0 deletions

View File

@ -464,6 +464,9 @@ public class QHybridSupport extends QHybridBaseSupport {
public void dispose() { public void dispose() {
LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(commandReceiver); LocalBroadcastManager.getInstance(getContext()).unregisterReceiver(commandReceiver);
GBApplication.getContext().unregisterReceiver(globalCommandReceiver); GBApplication.getContext().unregisterReceiver(globalCommandReceiver);
if (watchAdapter != null) {
watchAdapter.dispose();
}
super.dispose(); super.dispose();
} }

View File

@ -172,4 +172,8 @@ public abstract class WatchAdapter {
public void handleSetMenuStructure(JSONObject menuStructure) { public void handleSetMenuStructure(JSONObject menuStructure) {
} }
public void dispose() {
}
} }

View File

@ -156,6 +156,16 @@ public class FossilWatchAdapter extends WatchAdapter {
getDeviceInfos(); getDeviceInfos();
} }
@Override
public void dispose() {
if (timeoutLooper != null) {
timeoutHandler.removeCallbacks(requestTimeoutRunnable);
timeoutLooper.quit();
}
super.dispose();
}
private void restartRequestTimeout(){ private void restartRequestTimeout(){
if(timeoutLooper == null){ if(timeoutLooper == null){
return; return;