mirror of
https://github.com/mastodon/mastodon-android.git
synced 2025-01-31 02:44:48 +01:00
opti: avoid leaking response body when it's not used.
This commit is contained in:
parent
50760471d5
commit
bfc0076429
@ -113,8 +113,10 @@ public class MastodonAPIController{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException{
|
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException{
|
||||||
if(req.canceled)
|
if(req.canceled){
|
||||||
|
response.close();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if(BuildConfig.DEBUG)
|
if(BuildConfig.DEBUG)
|
||||||
Log.d(TAG, logTag(session)+hreq+" received response: "+response);
|
Log.d(TAG, logTag(session)+hreq+" received response: "+response);
|
||||||
synchronized(req){
|
synchronized(req){
|
||||||
|
@ -316,8 +316,10 @@ abstract class InstanceCatalogFragment extends BaseRecyclerFragment<CatalogInsta
|
|||||||
loadingInstanceRedirectRequest=null;
|
loadingInstanceRedirectRequest=null;
|
||||||
loadingInstanceDomain=null;
|
loadingInstanceDomain=null;
|
||||||
Activity a=getActivity();
|
Activity a=getActivity();
|
||||||
if(a==null)
|
if(a==null) {
|
||||||
|
response.close();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
try(response){
|
try(response){
|
||||||
if(!response.isSuccessful()){
|
if(!response.isSuccessful()){
|
||||||
a.runOnUiThread(()->{
|
a.runOnUiThread(()->{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user