[PyQt] How to write handwritten code to access the C++ object when the corresponding python object destroyed?

Weitian Leung weitianleung at gmail.com
Thu Feb 20 12:49:08 GMT 2020


Did you mean the wrapped class destructor? It's not the case I want...

struct IDemo
> {
>     virtual void do_sth(BSTR bstr) = 0;
> };
>

The IDemo is created by other C++ interface, the correct way to pass the
bstr to *do_sth *is call *SysAllocString*,
and after the call returned, we need call *SysFreeString* to free the bstr.
Because the IDemo instance will not take over the ownership of the bstr.

So when mapped the BSTR to str, it seems that we don't have any chance to
call the *SysFreeString *to free the str that allocated inside
*%ConvertToTypeCode.*



On Thu, Feb 20, 2020 at 5:07 PM Phil Thompson <phil at riverbankcomputing.com>
wrote:

> I meant the C++ destructor, not __dtor__.
>
> Phil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200220/c92ddfd0/attachment.html>


More information about the PyQt mailing list