[PyQt] sip struct dtor?

Paul Panzer paul_the_noob at outlook.com
Thu Jan 28 13:38:00 GMT 2016



> Subject: Re: [PyQt] sip struct dtor?
> From: phil at riverbankcomputing.com
> Date: Wed, 27 Jan 2016 21:34:39 +0000
> CC: pyqt at riverbankcomputing.com
> To: paul_the_noob at outlook.com
> 
> 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

Thanks, Phil. That works.
Btw., I think it may be worthwhile mentioning this in the docs.

Cheers, Paul

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160128/e31c001a/attachment.html>


More information about the PyQt mailing list