QRhiGles2: Skip GL cleanup on context loss

We are getting errors such as

  WebGL: INVALID_OPERATION: delete: object does not
  belong to this context

Normally, QRhiGles2::destroy() should delete/free all
GL resources. However if the GL context is lost then
there is not much we can do.

Task-number: QTBUG-120138
Change-Id: I6d00b10d72b7f7240499ceff0d002b88104009a0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
This commit is contained in:
Morten Sørvig 2024-07-19 13:59:40 +02:00
parent b57fac818b
commit a47f6fde87

View File

@ -1118,7 +1118,7 @@ void QRhiGles2::destroy()
if (!f) if (!f)
return; return;
ensureContext(); if (ensureContext()) {
executeDeferredReleases(); executeDeferredReleases();
if (ofr.tsQueries[0]) { if (ofr.tsQueries[0]) {
@ -1134,6 +1134,7 @@ void QRhiGles2::destroy()
for (uint shader : m_shaderCache) for (uint shader : m_shaderCache)
f->glDeleteShader(shader); f->glDeleteShader(shader);
m_shaderCache.clear(); m_shaderCache.clear();
}
if (!importedContext) { if (!importedContext) {
delete ctx; delete ctx;