Fix ref cnt'ing issue in GrProgramElement.
Drop ref on GrGpuResources when GrProgramElement loses its last ref and already has a pending execution. BUG=skia:2889 Review URL: https://codereview.chromium.org/612293003
This commit is contained in:
parent
6a6567458b
commit
d012877a6d
@ -44,8 +44,12 @@ public:
|
||||
void unref() const {
|
||||
this->validate();
|
||||
--fRefCnt;
|
||||
if (0 == fRefCnt && 0 == fPendingExecutions) {
|
||||
if (0 == fRefCnt) {
|
||||
if (0 == fPendingExecutions) {
|
||||
SkDELETE(this);
|
||||
} else {
|
||||
this->removeRefs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +84,8 @@ private:
|
||||
|
||||
void completedExecution() const;
|
||||
|
||||
void removeRefs() const;
|
||||
|
||||
mutable int32_t fRefCnt;
|
||||
// Count of deferred executions not yet issued to the 3D API.
|
||||
mutable int32_t fPendingExecutions;
|
||||
|
@ -31,9 +31,7 @@ void GrProgramElement::convertRefToPendingExecution() const {
|
||||
++fPendingExecutions;
|
||||
this->unref();
|
||||
if (0 == fRefCnt) {
|
||||
for (int i = 0; i < fGpuResources.count(); ++i) {
|
||||
fGpuResources[i]->removeRef();
|
||||
}
|
||||
this->removeRefs();
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,3 +51,9 @@ void GrProgramElement::completedExecution() const {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GrProgramElement::removeRefs() const {
|
||||
for (int i = 0; i < fGpuResources.count(); ++i) {
|
||||
fGpuResources[i]->removeRef();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user