gapi_returnCode_t
_DataReaderViewFree (
    _DataReaderView dataReaderView)
{
    gapi_returnCode_t result = GAPI_RETCODE_OK;
    u_dataView v;
    assert(dataReaderView);
    
    u_queryFree(dataReaderView->uQuery);
    
    gapi_loanRegistry_free(dataReaderView->loanRegistry);

    v = U_DATAREADERVIEW_GET(dataReaderView);
    _EntityDispose (_Entity(dataReaderView));
    u_dataViewFree(v);

    return result;
}
示例#2
0
gapi_returnCode_t
_DataReaderFree (
    _DataReader _this)
{
    gapi_returnCode_t result = GAPI_RETCODE_OK;
    _Status status;
    u_dataReader r;

    assert(_this);

    /* The following refCount checking and destruction mechanism is not
     * bullet proof and may cause leakage.
     * This is a temporary situation during GAPI redesign and should be
     * resolved when the GAPI redesign is finished.
     */
    r = U_DATAREADER_GET(_this);
    _TopicDescriptionDecUse(_this->topicDescription);

    status = _EntityStatus(_this);

    _StatusSetListener(status, NULL, 0);

    _EntityClaim(status);
    _StatusDeinit(status);

    gapi_loanRegistry_free(_this->loanRegistry);

    /* Following the user layer reader object is deleted after the entity
     * dispose because it will otherwise lead to a double free of the user
     * layer reader.
     * This is caused by the status condition which is attached to an exiting
     * waitset and the fact that a status condition's user object is the user
     * layer reader.
     * This is a hack but besides of that the destruction of the user entity
     * should be part of the entity dispose method.
     * For now this works.
     */
    _EntityDispose(_Entity(_this));
    u_dataReaderFree(r);

    return result;
}