Opened 6 years ago

Closed 5 years ago

#912 closed defect (fixed)

bintree::Bintree API hides implementation and leads to SEGFAULT.

Reported by: basiliscos Owned by: dbaston
Priority: major Milestone:
Component: Default Version: 3.6.2
Severity: Unassigned Keywords:
Cc:

Description

Bintree::insert (Interval *itemInterval, void *item) states

Parameters

itemInterval	Ownership left to caller, NO reference hold by this class.
    item	Ownership left to caller, reference kept by this class. 

In implementation it leads to

root->insert(insertInterval,item);
...
void NodeBase::add(void* item){
        items->push_back(item);
}

and in the destructor of NodeBase

NodeBase::~NodeBase() {
        for(int i=0;i<(int)items->size();i++) {
                delete (MonotoneChain*)(*items)[i];
        }

it, first, casts to MonotoneChain (i.e. it violates void* contract), and, second, it invokes destructor, i.e. opposite to what is stated in documentation about item ownership.

Please, fix.

Change History (3)

comment:1 by dbaston, 5 years ago

Owner: changed from geos-devel@… to dbaston

comment:2 by dbaston, 5 years ago

Resolved in master in git:fe5f16c8f00dad. Could be backported to 3.7 but I don't think it's critical.

comment:3 by dbaston, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.