10000 Fix resource leaks when switching between tabs by felipeerias · Pull Request #1856 · Igalia/wolvic · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix resource leaks when switching between tabs #1856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

felipeerias
Copy link
Collaborator

Several fixes to the process of switching between different tabs, specially when they are showing a native UI line the New Tab.

Ensure that the surface held by WindowWidget is released at the same time as the session is notified that it is no longer valid.

Move setupListeners() towards the end of the setSession() because it will cause session listeners to be called synchronously with the new values and we need to have a consistent state at that point.

Ensure that listeners are not set up on a session that is not the current one.

Fixes #1841

Several fixes to the process of switching between different tabs,
specially when they are showing a native UI line the New Tab.

Ensure that the surface held by WindowWidget is released at the
same time as the session is notified that it is no longer valid.

Move setupListeners() towards the end of the setSession() because
it will cause session listeners to be called synchronously with
the new values and we need to have a consistent state at that point.

Ensure that listeners are not set up on a session that is not the
current one.

Fixes #1841
if (aSession != mSession) {
Log.w(LOGTAG, "Tried to set up listeners on a session that is not the current one.");
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that even possible? If not it should be better to assert as it will unveil a more important issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to not have any impact on the issues either.

@@ -1258,18 +1267,20 @@ public void setSession(@NonNull Session aSession, @OldSessionDisplayAction int a

mSession = aSession;

setupListeners(mSession);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to have no effect on any of the issues. Why we need it ?

if (aSession != mSession) {
Log.w(LOGTAG, "Tried to set up listeners on a session that is not the current one.");
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to not have any impact on the issues either.

@@ -634,6 +638,11 @@ public void pauseCompositor() {
return;
}

// Ensure that the surface is not left in an inconsistent state.
if (mSurface != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems the only change that fixes the issue.

@javifernandez
Copy link
Member

I have done some testing without the allegedly spurious changes and, even though not strictly necessary to solve the crashes described in the issues #1841 and #1854, they are useful (at least the one about the listeners) to solve (or mitigate) an issue when switching very fast among several tabs and windows; with the leak solved, there is no crash but the web-content is shown as a black window after a few times.

I could accept to merge all the changes in this PR, but perhaps we could do it in different commits. Ideally we should investigate the behavior I have described, file a new issue and make an independent PR to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when quickly switching between "New Tab" tabs
3 participants
0