Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af5856d2 authored by Vincent Breitmoser's avatar Vincent Breitmoser Committed by cketti
Browse files

avoid leaking data to MessagingController via MessageLoaderHelper after detach

null handling is already present: no ui methods should ever be called
after onDestroy or onDetachChangingConfigurations, and pending result
callbacks are handled by a null-check for the callback field.
parent 0993d914
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -69,11 +69,11 @@ public class MessageLoaderHelper {
    private static final int DECODE_MESSAGE_LOADER_ID = 2;


    // injected state
    private final Context context;
    private final FragmentManager fragmentManager;
    private final LoaderManager loaderManager;
    @Nullable // may be cleared
    // injected state - all of this may be cleared to avoid data leakage!
    private Context context;
    private FragmentManager fragmentManager;
    private LoaderManager loaderManager;
    @Nullable // make this explicitly nullable, make sure to cancel/ignore any operation if this is null
    private MessageLoaderCallbacks callback;


@@ -126,6 +126,9 @@ public class MessageLoaderHelper {
        }

        callback = null;
        context = null;
        fragmentManager = null;
        loaderManager = null;
    }

    /** Prevents future callbacks, but retains loading state to pick up from in a call to
@@ -137,6 +140,9 @@ public class MessageLoaderHelper {
        }

        callback = null;
        context = null;
        fragmentManager = null;
        loaderManager = null;
    }

    @UiThread