Commit 7fcd70c
committed
webgl context objects leak fix
Changing order of operations in ~WebGLRenderingContextBase
Otherwise, WebGLContextGroup will not be able to release some of the
'group shared' resources that still have attachements when being removed
via WebGLSharedObject destructor - it happens eg. for
WebGLVertexArrayObjectBase objects that have buffers set on
destruction time.
The current behaviour in ~WebGLRenderingContextBase:
- first, the reference to some WebGLSharedObject (like m_boundArrayBuffer)
is nullified
- since this decreases refcnt to 0, destructor for this WebGLSharedObject is
executed - this goes via WebGLObject::runDestructor() -> WebGLObject::deleteObject.
- WebGLObject::deleteObject checks for attachement count (m_attachmentCount)
and if it's not 0 it will not execute deleteObjectImpl (where the actual
removal from the context takes place).
- So the reference to the object is destructed, and ~WebGLSharedObject removes
the object from m_contextGroup as well. At this point the resource is leaked.
With the fix, m_contextGroup->removeContext(*this) is executed at the beginning
of ~WebGLRenderingContextBase - this calls detach() on all the objects
(WebGLContextGroup::detachAndRemoveAllObjects) so is possible to release them.1 parent f0b98a4 commit 7fcd70c
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1238 | 1238 | | |
1239 | 1239 | | |
1240 | 1240 | | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
1241 | 1248 | | |
1242 | 1249 | | |
1243 | 1250 | | |
| |||
1262 | 1269 | | |
1263 | 1270 | | |
1264 | 1271 | | |
1265 | | - | |
1266 | 1272 | | |
1267 | 1273 | | |
1268 | 1274 | | |
| |||
0 commit comments