Commit 8f5f8a45 authored by claes's avatar claes

Even status is returned instead of throw to fix refcount problems

parent 5ec55588
...@@ -34,20 +34,15 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * orep) : ...@@ -34,20 +34,15 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep * orep) :
else { else {
m_orep->ref(); m_orep->ref();
// m_size == get rtbody size... Fix
wb_cdef cdef(*orep); wb_cdef cdef(*orep);
if (EVEN(cdef.sts())) { if (EVEN(cdef.sts())) {
char msg[256];
m_sts = cdef.sts(); m_sts = cdef.sts();
sprintf(msg, "Can't get cdef for orep: %s", orep->name()); return;
throw wb_error_str(m_sts, msg);
} }
wb_bdef bdef(((wb_cdrep *)cdef)->bdrep(&m_sts, pwr_eBix_rt)); wb_bdef bdef(((wb_cdrep *)cdef)->bdrep(&m_sts, pwr_eBix_rt));
if (EVEN(bdef.sts())) { if (EVEN(bdef.sts())) {
char msg[256];
m_sts = bdef.sts(); m_sts = bdef.sts();
sprintf(msg, "Can't get bdef for orep: %s", orep->name()); return;
throw wb_error_str(m_sts, msg);
} }
m_size = bdef.size(); m_size = bdef.size();
...@@ -117,8 +112,11 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname) : ...@@ -117,8 +112,11 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname) :
if ( orep == 0) if ( orep == 0)
m_sts = LDH__NOSUCHATTR; m_sts = LDH__NOSUCHATTR;
else { else {
m_orep->ref();
wb_cdrep *cd = m_orep->vrep()->merep()->cdrep( &m_sts, m_orep->cid()); wb_cdrep *cd = m_orep->vrep()->merep()->cdrep( &m_sts, m_orep->cid());
if ( oddSts()) { if ( oddSts()) {
wb_bdrep *bd = cd->bdrep( &m_sts, bname); wb_bdrep *bd = cd->bdrep( &m_sts, bname);
if ( oddSts()) { if ( oddSts()) {
m_size = bd->size(); m_size = bd->size();
...@@ -127,10 +125,6 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname) : ...@@ -127,10 +125,6 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname) :
} }
delete cd; delete cd;
} }
if ( oddSts())
m_orep->ref();
else
m_orep = 0;
} }
} }
...@@ -141,6 +135,8 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname, co ...@@ -141,6 +135,8 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname, co
if ( orep == 0) if ( orep == 0)
m_sts = LDH__NOSUCHATTR; m_sts = LDH__NOSUCHATTR;
else { else {
m_orep->ref();
wb_attrname n = wb_attrname(aname); wb_attrname n = wb_attrname(aname);
wb_bdrep *bd = 0; wb_bdrep *bd = 0;
wb_cdrep *cd = m_orep->vrep()->merep()->cdrep( &m_sts, m_orep->cid()); wb_cdrep *cd = m_orep->vrep()->merep()->cdrep( &m_sts, m_orep->cid());
...@@ -172,10 +168,10 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname, co ...@@ -172,10 +168,10 @@ wb_attribute::wb_attribute(pwr_tStatus sts, wb_orep* orep, const char *bname, co
if ( bd) if ( bd)
delete bd; delete bd;
} }
if ( oddSts()) // if ( oddSts())
m_orep->ref(); // m_orep->ref();
else // else
m_orep = 0; // m_orep = 0;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment