Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b38d5348 authored by Jason Sams's avatar Jason Sams
Browse files

Fix refcounting bugs where the sys refcount

could be corrupted during async type creation.

Change-Id: If42828e92990598b0cb5da81c82ea513f94725f2

Fix stack object deletion bug.

Change-Id: I2c723aa5ad15e0c99dc9cd0cfbc7db80bace172a
parent 4924aee9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -288,7 +288,7 @@ typedef struct {


// Async commands for returning new IDS
void * rsaTypeCreate(RsContext, RsElement, uint32_t dimCount,
RsType rsaTypeCreate(RsContext, RsElement, uint32_t dimCount,
                     const RsDimension *dims, const uint32_t *vals);


+2 −10
Original line number Diff line number Diff line
@@ -27,15 +27,11 @@ using namespace android::renderscript;

Adapter1D::Adapter1D(Context *rsc) : ObjectBase(rsc)
{
    mAllocFile = __FILE__;
    mAllocLine = __LINE__;
    reset();
}

Adapter1D::Adapter1D(Context *rsc, Allocation *a) : ObjectBase(rsc)
{
    mAllocFile = __FILE__;
    mAllocLine = __LINE__;
    reset();
    setAllocation(a);
}
@@ -145,15 +141,11 @@ void rsi_Adapter1DData(Context *rsc, RsAdapter1D va, const void *data)

Adapter2D::Adapter2D(Context *rsc) : ObjectBase(rsc)
{
    mAllocFile = __FILE__;
    mAllocLine = __LINE__;
    reset();
}

Adapter2D::Adapter2D(Context *rsc, Allocation *a) : ObjectBase(rsc)
{
    mAllocFile = __FILE__;
    mAllocLine = __LINE__;
    reset();
    setAllocation(a);
}
+1 −3
Original line number Diff line number Diff line
@@ -57,8 +57,6 @@ Allocation::Allocation(Context *rsc, const Type *type, void *bmp,

void Allocation::init(Context *rsc, const Type *type)
{
    mAllocFile = __FILE__;
    mAllocLine = __LINE__;
    mPtr = NULL;

    mCpuWrite = false;
@@ -478,7 +476,7 @@ Allocation *Allocation::createFromStream(Context *rsc, IStream *stream)
    uint32_t dataSize = stream->loadU32();
    if(dataSize != type->getSizeBytes()) {
        LOGE("failed to read allocation because numbytes written is not the same loaded type wants\n");
        delete type;
        ObjectBase::checkDelete(type);
        return NULL;
    }

+1 −3
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@ using namespace android::renderscript;
Element::Element(Context *rsc) : ObjectBase(rsc)
{
    mBits = 0;
    mAllocFile = __FILE__;
    mAllocLine = __LINE__;
    mFields = NULL;
    mFieldCount = 0;
    mHasReference = false;
@@ -140,7 +138,7 @@ Element *Element::createFromStream(Context *rsc, IStream *stream)
    for (uint32_t ct=0; ct < rsc->mStateElement.mElements.size(); ct++) {
        Element *ee = rsc->mStateElement.mElements[ct];
        if(ee->isEqual(elem)) {
            delete elem;
            ObjectBase::checkDelete(elem);
            ee->incUserRef();
            return ee;
        }
+1 −3
Original line number Diff line number Diff line
@@ -36,8 +36,6 @@ using namespace android::renderscript;

Font::Font(Context *rsc) : ObjectBase(rsc), mCachedGlyphs(NULL)
{
    mAllocFile = __FILE__;
    mAllocLine = __LINE__;
    mInitialized = false;
    mHasKerning = false;
    mFace = NULL;
@@ -308,7 +306,7 @@ Font * Font::create(Context *rsc, const char *name, uint32_t fontSize, uint32_t
        return newFont;
    }

    delete newFont;
    ObjectBase::checkDelete(newFont);
    return NULL;

}
Loading