Don't abort if the qml WebContext is destroyed before any webviews that use it

Bug #1292618 reported by Chris Coulson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Oxide
Fix Released
Critical
Chris Coulson

Bug Description

Currently the qml WebContext owns its BrowserContext, and we assert that BrowserContext outlives all WebView's that are using it. This is unfortunate, as it's quite easy for a simple mistake in qml to trigger an application abort.

What we should probably do is:

- Make BrowserContext reference counted
- Keep a reference to it from the qml WebContext, and any WebView's that use it
- Make WebContextAdapter a Data object on BrowserContext (using base::SupportsUserData)
- When the qml WebContext and associated WebContextAdapter is deleted, clear the Data object from BrowserContext
- When accessing WebView.context, retrieve this via the Data object on BrowserContext
- If the Data object doesn't exist, create a new qml WebContext, add its WebContextAdapter to BrowserContext and return this.

The last couple of points are important - if a qml WebContext goes out of scope and is deleted, but the underlying BrowserContext is still in use by some webviews, we still want a way to access the context via WebView.context. And for WebView's that share a context, the returned contexts must always be the same.

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Of course, this is complicated by the fact that there are 2 BrowserContext's for every Qml WebContext, and the lifetime of those must be identical

Changed in oxide:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

This is triggered as well by the test case in bug 1292593

Changed in oxide:
importance: Medium → Critical
assignee: nobody → Chris Coulson (chrisccoulson)
status: Triaged → Won't Fix
status: Won't Fix → In Progress
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

This is partially fixed. However, once WebContext is deleted, there is no way to access the currently in use context on WebView.context, which is kind of weird. But it doesn't abort now

Changed in oxide:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.