[C++-sig] Assert fail during deletion for an obj containing external object ptr

Roman Yakovenko roman.yakovenko at gmail.com
Mon Sep 18 16:24:59 CEST 2006


On 9/18/06, Gangadhar NPK <npk.gangadhar at gmail.com> wrote:
> All,
> I am a beginner for Boost.Python, so please be kind on the responses.
> I am trying to create python wrappers for an existing library. I can't
> change the source of the library ( I don't even have the src to
> change). Also, since most of the classes are via factories, I can't
> try to derive from the base classes, so am providing the wrappers by
> containership. The python wrappers will contain the pointers to the
> 3rd party libs.
>
> When I do this, I am able to get the interface to the third party
> library's base interface, but during destruction (during the
> interpretor exit), I get this assert failure:
> ---------------------------
> Microsoft Visual C++ Debug Library
> ---------------------------
> Debug Assertion Failed!
> Program: c:\Python24\python.exe
> File: dbgdel.cpp
> Line: 51
> Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
> For information on how your program can cause an assertion
> failure, see the Visual C++ documentation on asserts.
> (Press Retry to debug the application)
> ---------------------------
> Abort   Retry   Ignore
> ---------------------------
> I understand that there might be a double delete or invalid deletion
> that is happening, but I can't point exactly where. The code that
> generates is attached as a CPP file.
> This must be something basic that I am missing, but I can't figure out
> from the boost.python documentation or the wiki. Can someone please
> point at what I am doing wrong?
>
> Thank You
> Gangadhar
> P.S:Also, ignore the fact that the 3rd party lib's static function is
> not exported in the Wrapper class as a member function. That is
> something that will be changed later.

This is not a bug. If you want to debug your extension you will need
Python built
in "debug" mode. Try to compile your extension in release mode and it
should work.
( At least the example you attached )

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list