Make sure to call gl finishCallbacks if we are disconnected or deleting the GrGLGpu.

Our contract is that we will call the finishedCallbacks at some point. So if we
are either abandoning or just deleting the GrGLGpu make sure we call any outstanding
callbacks.

Change-Id: I1425e951185d350a1faa567f0342822c41aafb65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272650
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2020-02-21 14:41:36 -05:00 committed by Skia Commit-Bot
parent 6fa47769cb
commit 822f7b2543

View File

@ -453,6 +453,12 @@ GrGLGpu::~GrGLGpu() {
}
fSamplerObjectCache.reset();
while (!fFinishCallbacks.empty()) {
fFinishCallbacks.front().fCallback(fFinishCallbacks.front().fContext);
this->deleteSync(fFinishCallbacks.front().fSync);
fFinishCallbacks.pop_front();
}
}
void GrGLGpu::disconnect(DisconnectType type) {
@ -512,6 +518,14 @@ void GrGLGpu::disconnect(DisconnectType type) {
if (this->glCaps().shaderCaps()->pathRenderingSupport()) {
this->glPathRendering()->disconnect(type);
}
while (!fFinishCallbacks.empty()) {
fFinishCallbacks.front().fCallback(fFinishCallbacks.front().fContext);
if (DisconnectType::kCleanup == type) {
this->deleteSync(fFinishCallbacks.front().fSync);
}
fFinishCallbacks.pop_front();
}
}
///////////////////////////////////////////////////////////////////////////////