Boost logo

Boost Users :

From: Craigus (yg-boost-users_at_[hidden])
Date: 2002-06-12 06:32:46


Hi

I'm new to using the Boost library. I'm using the shared_ptr because I
can't do what I want to do with the std::auto_ptr (which is to have them
stored in other STL containers). I ran into the following problem in C++
Builder 5, patch 1-

I have Codeguard turned on (detects memory leaks, accessing freed memory,
overwriting memory illegally and the like). When the shared_ptr object
count goes to zero operator() in checked_deleter eventually gets called.
Codeguard is reporting (in poor English):

Method called on illegally casted object

It doesn't matter what type the shared_ptr holds. I even tried a console
program that contains only the following line (apart from return 0; of
course :-):

boost::shared_ptr< int > tmp( new int );

As soon as that object goes out of scope it is destroyed and operator() is
called as I indicated above and Codeguard reports the error.

Has anyone else seen this behaviour ? I was originally using Boost 1.27,
which gave me the same error when I used the reset method. I downloaded
1.28 and that went away so that now it's only happening when the actual
shared_ptr object is destroyed. I don't have much idea of what's going on
inside the shared_ptr, so I don't even know where to start looking. Any
help will be much appreciated.

Thanks
Craigus


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net