[PyKDE] c++ destructor call omitted

Herman, Geza geza at bitquad.com
Sat Jul 1 15:25:10 BST 2006


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?

Thanks,
Geza Herman

ps: this applies to version 4.4.5




More information about the PyQt mailing list