libgui: Change detachNextBuffer to return sp<GB>

Changes Surface::detachNextBuffer to return an sp<GraphicBuffer>
instead of an ANativeWindowBuffer* to ensure that reference counting
works correctly.

Bug: 20092217
Change-Id: I3979ea6121aaf14845f0554477b778770413581e
(cherry picked from commit 8b2daa3ca29492b181fb67840640d771c4a2b3ac)
This commit is contained in:
Dan Stoza 2015-04-27 11:06:01 -07:00
parent 63a0f42823
commit d9c4971da2
2 changed files with 3 additions and 3 deletions

View File

@ -179,7 +179,7 @@ public:
virtual int unlockAndPost();
virtual int connect(int api, const sp<IProducerListener>& listener);
virtual int detachNextBuffer(ANativeWindowBuffer** outBuffer,
virtual int detachNextBuffer(sp<GraphicBuffer>* outBuffer,
sp<Fence>* outFence);
virtual int attachBuffer(ANativeWindowBuffer*);

View File

@ -651,7 +651,7 @@ int Surface::disconnect(int api) {
return err;
}
int Surface::detachNextBuffer(ANativeWindowBuffer** outBuffer,
int Surface::detachNextBuffer(sp<GraphicBuffer>* outBuffer,
sp<Fence>* outFence) {
ATRACE_CALL();
ALOGV("Surface::detachNextBuffer");
@ -670,7 +670,7 @@ int Surface::detachNextBuffer(ANativeWindowBuffer** outBuffer,
return result;
}
*outBuffer = buffer.get();
*outBuffer = buffer;
if (fence != NULL && fence->isValid()) {
*outFence = fence;
} else {