Skip to content

Commit

Permalink
Post firstDrawCallback runnable to avoid a deadlock if the widget is …
Browse files Browse the repository at this point in the history
…resized in that callback. (#1486)
  • Loading branch information
MortimerGoro authored and keianhzo committed Aug 2, 2019
1 parent 648c8c4 commit b8ccd64
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -17,6 +17,7 @@
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;

import org.mozilla.gecko.util.ThreadUtils;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.GeckoDisplay;
import org.mozilla.geckoview.GeckoResult;
Expand Down Expand Up @@ -782,7 +783,9 @@ public void onCrash(GeckoSession session) {
@Override
public void onFirstComposite(GeckoSession session) {
if (mFirstDrawCallback != null) {
mFirstDrawCallback.run();
// Post this call because running it synchronously can cause a deadlock if the runnable
// resizes the widget and calls surfaceChanged. See https://github.com/MozillaReality/FirefoxReality/issues/1459.
ThreadUtils.postToUiThread(mFirstDrawCallback);
mFirstDrawCallback = null;
}
}
Expand Down

0 comments on commit b8ccd64

Please sign in to comment.