[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] sip struct dtor?
From:       Paul Panzer <paul_the_noob () outlook ! com>
Date:       2016-01-28 13:38:00
Message-ID: SNT147-W265A89571B6D5235BC26ACA1DA0 () phx ! gbl
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

 		 	   		  


[Attachment #5 (text/html)]

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><br><br><div>&gt; Subject: Re: [PyQt] sip \
struct dtor?<br>&gt; From: phil@riverbankcomputing.com<br>&gt; Date: Wed, 27 Jan 2016 \
21:34:39 +0000<br>&gt; CC: pyqt@riverbankcomputing.com<br>&gt; To: \
paul_the_noob@outlook.com<br>&gt; <br>&gt; On 27 Jan 2016, at 7:12 pm, Paul Panzer \
&lt;paul_the_noob@outlook.com&gt; wrote:<br>&gt; &gt; <br>&gt; &gt; Hi,<br>&gt; &gt; \
<br>&gt; &gt; I'm new to sip, so please be patient.<br>&gt; &gt; I'm trying to wrap a \
C struct that has some pointer members.<br>&gt; &gt; It comes with a factory that \
dynamically allocates memory addressed by these pointers.<br>&gt; &gt; Now, when the \
struct is freed how can I make sure this memory is freed?<br>&gt; &gt; I don't \
suppose sip does it automatically?<br>&gt; &gt; 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.<br>&gt; &gt; So is there a way to specify handwritten \
destructor code in this situation?<br>&gt; <br>&gt; Give the struct a C++-style dtor \
and define %MethodCode for it.<br>&gt; <br>&gt; Phil<br><br>Thanks, Phil. That \
works.<br>Btw., I think it may be worthwhile mentioning this in the \
docs.<br><br>Cheers, Paul<br><br></div> 		 	   		  </div></body> </html>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic