[PyKDE] c++ destructor call omitted

Phil Thompson phil at riverbankcomputing.co.uk
Tue Jul 4 17:20:03 BST 2006


On Saturday 01 July 2006 3:25 pm, Herman, Geza wrote:
> Hi,
>
> I found something in sipgen/gencode.c (lines 4176-4209) that may be a
> bug: destructor call is omitted if the c++ class can't be created.
>
> For ex., this causes memory leak:
>
> --- c++ -----------------
>
> class Foo {
>          private:
>                  Foo() { }
>          public:
>                  ~Foo() { }
>
>                  // public stuff
>
>                  friend class Bar;
> };
>
> class Bar {
>          public:
>                  Foo getAFoo() {
>                          return Foo();
>                  }
> };
>
> ---- sip ----------------
>
> class Foo {
>          private:
>                  Foo();
>          public:
>                  // public stuff
> };
>
> class Bar {
>          public:
>                  Foo getAFoo();
> };
>
> -------------------------
>
> Here, Bar can create a Foo. The problem is that release_Foo is generated
> as an empty function. If Foo's constructor wasn't private, release_Foo
> calls delete correctly. Am I mistaken, or this is a bug?

Yes, it's a bug. Fixed in tonight's snapshot.

Phil




More information about the PyQt mailing list