Fix a crash

custom_intent
Thomas 11 months ago
parent 3148d5f9b2
commit 5b805ca9a9

@ -193,7 +193,11 @@ public abstract class PeertubeBaseMainActivity extends BaseActivity implements C
super.onDestroy(); super.onDestroy();
ChromeCasts.unregisterListener(this); ChromeCasts.unregisterListener(this);
if (manage_chromecast != null) { if (manage_chromecast != null) {
try {
unregisterReceiver(manage_chromecast); unregisterReceiver(manage_chromecast);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
new Thread(() -> { new Thread(() -> {
if (chromeCasts != null && chromeCasts.size() > 0) { if (chromeCasts != null && chromeCasts.size() > 0) {
for (ChromeCast cast : chromeCasts) { for (ChromeCast cast : chromeCasts) {

@ -1859,9 +1859,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
@Override @Override
protected void onDestroy() { protected void onDestroy() {
try {
unregisterReceiver(broadcast_data); unregisterReceiver(broadcast_data);
unregisterReceiver(broadcast_error_message); unregisterReceiver(broadcast_error_message);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
if (networkStateReceiver != null) { if (networkStateReceiver != null) {
try { try {
unregisterReceiver(networkStateReceiver); unregisterReceiver(networkStateReceiver);

@ -195,8 +195,11 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
if (timer != null) { if (timer != null) {
timer.cancel(); timer.cancel();
} }
try {
unregisterReceiver(imageReceiver); unregisterReceiver(imageReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
} }

@ -367,7 +367,11 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
@Override @Override
public void onDestroy() { public void onDestroy() {
try {
unregisterReceiver(onDownloadComplete); unregisterReceiver(onDownloadComplete);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroy(); super.onDestroy();
} }

@ -1260,7 +1260,11 @@ public class ProfileActivity extends BaseActivity {
scheduledExecutorService.shutdownNow(); scheduledExecutorService.shutdownNow();
scheduledExecutorService = null; scheduledExecutorService = null;
} }
try {
unregisterReceiver(broadcast_data); unregisterReceiver(broadcast_data);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroy(); super.onDestroy();
} }

@ -340,7 +340,11 @@ public class AdminActionActivity extends BaseBarActivity {
protected void onDestroy() { protected void onDestroy() {
super.onDestroy(); super.onDestroy();
if (mReceiver != null) { if (mReceiver != null) {
try {
unregisterReceiver(mReceiver); unregisterReceiver(mReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
} }
} }

@ -295,7 +295,11 @@ public class FragmentMastodonContext extends Fragment {
@Override @Override
public void onDestroyView() { public void onDestroyView() {
try {
requireActivity().unregisterReceiver(receive_action); requireActivity().unregisterReceiver(receive_action);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroyView(); super.onDestroyView();
} }

@ -272,7 +272,11 @@ public class FragmentMastodonDirectMessage extends Fragment {
@Override @Override
public void onDestroyView() { public void onDestroyView() {
try {
requireActivity().unregisterReceiver(broadcast_data); requireActivity().unregisterReceiver(broadcast_data);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
super.onDestroyView(); super.onDestroyView();
} }

@ -675,8 +675,13 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
@Override @Override
public void onDestroyView() { public void onDestroyView() {
try {
requireActivity().unregisterReceiver(receive_action); requireActivity().unregisterReceiver(receive_action);
requireActivity().unregisterReceiver(receive_refresh); requireActivity().unregisterReceiver(receive_refresh);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
if (isAdded()) { if (isAdded()) {
storeMarker(); storeMarker();
} }

@ -1596,7 +1596,11 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
private void unregisterReceiver() { private void unregisterReceiver() {
if (mPowerKeyReceiver != null) { if (mPowerKeyReceiver != null) {
try {
unregisterReceiver(mPowerKeyReceiver); unregisterReceiver(mPowerKeyReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
mPowerKeyReceiver = null; mPowerKeyReceiver = null;
} }
} }

@ -153,7 +153,11 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
if (!keepRemote) { if (!keepRemote) {
typeOfConnection = TypeOfConnection.NORMAL; typeOfConnection = TypeOfConnection.NORMAL;
} }
try {
unregisterReceiver(broadcast_data); unregisterReceiver(broadcast_data);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
} }
@SuppressLint("ApplySharedPref") @SuppressLint("ApplySharedPref")

@ -125,7 +125,11 @@ public class RetrieveInfoService extends Service implements NetworkStateReceiver
super.onDestroy(); super.onDestroy();
if (networkStateReceiver != null) { if (networkStateReceiver != null) {
networkStateReceiver.removeListener(this); networkStateReceiver.removeListener(this);
try {
unregisterReceiver(networkStateReceiver); unregisterReceiver(networkStateReceiver);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
} }
} }

Loading…
Cancel
Save