[PyQt] sip struct dtor?

Phil Thompson phil at riverbankcomputing.com
Wed Jan 27 21:34:39 GMT 2016


On 27 Jan 2016, at 7:12 pm, Paul Panzer <paul_the_noob at outlook.com> wrote:
> 
> Hi,
> 
> I'm new to sip, so please be patient.
> I'm trying to wrap a C struct that has some pointer members.
> It comes with a factory that dynamically allocates memory addressed by these pointers.
> Now, when the struct is freed how can I make sure this memory is freed?
> I don't suppose sip does it automatically?
> Even if so, I'm sure there are situations where upon destruction of the struct some cleanup is required which sip couldn't possibly guess.
> So is there a way to specify handwritten destructor code in this situation?

Give the struct a C++-style dtor and define %MethodCode for it.

Phil


More information about the PyQt mailing list