Bug 741319 - Delete textures using the same context used to create them, on the thread that owns that context. r=joe
This commit is contained in:
@@ -83,8 +83,8 @@ public:
|
||||
void
|
||||
GLTexture::Allocate(GLContext *aContext)
|
||||
{
|
||||
NS_ASSERTION(aContext->IsGlobalSharedContext() ||
|
||||
NS_IsMainThread(), "Can only allocate texture on main thread or with cx sharing");
|
||||
NS_ASSERTION(aContext->IsGlobalSharedContext() || aContext->IsOwningThreadCurrent(),
|
||||
"Can only allocate texture on context's owning thread or with cx sharing");
|
||||
|
||||
Release();
|
||||
|
||||
@@ -122,13 +122,14 @@ GLTexture::Release()
|
||||
}
|
||||
|
||||
if (mTexture) {
|
||||
if (NS_IsMainThread() || mContext->IsGlobalSharedContext()) {
|
||||
if (mContext->IsOwningThreadCurrent() || mContext->IsGlobalSharedContext()) {
|
||||
mContext->MakeCurrent();
|
||||
mContext->fDeleteTextures(1, &mTexture);
|
||||
} else {
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
new TextureDeleter(mContext.forget(), mTexture);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
new TextureDeleter(mContext.get(), mTexture);
|
||||
mContext->DispatchToOwningThread(runnable);
|
||||
mContext.forget();
|
||||
}
|
||||
|
||||
mTexture = 0;
|
||||
|
||||
Reference in New Issue
Block a user