hi,

When setting a ComDiagsArea, I find the refCount did not increase, in function 
atp_struct::setDiagsArea of file core/sql/exp/ExpAtp.h:

inline void atp_struct::setDiagsArea(ComDiagsArea* diagsArea)
{
  if (diagsArea_)
    diagsArea_->decrRefCount();

  diagsArea_ = diagsArea;
}

I guess this is a problem.

There are two solutions to fix this:

1.     Invoke incrRefCount for ComDiagsArea to increase, just after the 
assignment.

2.     Overload the operator= for ComDiagsArea, to increase within the 
operator=,
I find operator= is declared in ComDiags.h, but there is no implementation.

The 2nd solution may be better, as the both increment for the left-hand side 
ComDiagsArea and
the decrement for the right-hand side ComDiagsAre can be handled within a 
single operator=,
which is friendly to users, like shared_ptr in C++.

Regards,
Wenjun Zhu

Reply via email to