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

List:       pykde
Subject:    struct ownership, cpp SIP
From:       Marian Thomsen <marian.th () outlook ! de>
Date:       2021-04-21 10:37:04
Message-ID: AM0PR0502MB3764AF3FE0BD58F3D85FC65296479 () AM0PR0502MB3764 ! eurprd05 ! prod ! outlook ! com
[Download RAW message or body]

Hello,

I'm translating a c++ api that has a struct cascade. A struct0 holding struct1 that \
holds struct2 and so on. In some situations it is necessary to fill e.g. struct 2 \
with values and pass (by assignment =) it to struct1. When I'm doing this in a loop I \
get a segmentation fault.

I suspect that struct1 has not ownership of struct2 and struct2 gets deleted to \
early. My current workaround is to declare struct2 globally, but I would like to find \
another solution in the long run.

Is there something I can do about that with SIP? Can I e.g. force the transfer of \
ownership during the assignment from struct2 to struct1 somehow?

Thanks for the help.

Regards,

M.T.


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} \
</style> </head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> Hello,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> I'm translating a c++ api that has a struct cascade. A struct0 \
holding struct1 that holds struct2 and so on.</div> <div style="font-family: Calibri, \
Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"> In some \
situations it is necessary to fill e.g. struct 2 with values and pass (by assignment \
=) it to struct1. When I'm doing this in a loop I get a segmentation fault.<br> \
</div> <div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: \
12pt; color: rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> I suspect that struct1 has not ownership of struct2 and \
struct2 gets deleted to early. My current workaround is to declare struct2 globally, \
but I would like to find another solution in the long run.</div> <div \
style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: \
rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> Is there something I can do about that with SIP? Can I e.g. \
force the transfer of ownership during the assignment from struct2 to struct1 \
somehow?</div> <div style="font-family: Calibri, Arial, Helvetica, sans-serif; \
font-size: 12pt; color: rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> Thanks for the help.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; \
color: rgb(0, 0, 0);"> M.T.<br>
</div>
</body>
</html>



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

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