[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>> Subject: Re: [PyQt] sip \
struct dtor?<br>> From: phil@riverbankcomputing.com<br>> Date: Wed, 27 Jan 2016 \
21:34:39 +0000<br>> CC: pyqt@riverbankcomputing.com<br>> To: \
paul_the_noob@outlook.com<br>> <br>> On 27 Jan 2016, at 7:12 pm, Paul Panzer \
<paul_the_noob@outlook.com> wrote:<br>> > <br>> > Hi,<br>> > \
<br>> > I'm new to sip, so please be patient.<br>> > I'm trying to wrap a \
C struct that has some pointer members.<br>> > It comes with a factory that \
dynamically allocates memory addressed by these pointers.<br>> > Now, when the \
struct is freed how can I make sure this memory is freed?<br>> > I don't \
suppose sip does it automatically?<br>> > 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>> > So is there a way to specify handwritten \
destructor code in this situation?<br>> <br>> Give the struct a C++-style dtor \
and define %MethodCode for it.<br>> <br>> 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