[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: Destroying toolviews in python
From: Alex Turbov <i.zaufi () gmail ! com>
Date: 2014-02-18 20:39:45
Message-ID: CANktQtsYJxZAvAjbo2n2jwvoHqduRyLTPq05zpYkgnjV==ea-w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On Wed, Feb 19, 2014 at 12:07 AM, Philipp A. <flying-sheep@web.de> wrote:
> 2014-02-18 19:15 GMT+01:00 Alex Turbov <i.zaufi@gmail.com>:
>
> the problem already solved for color_tools and cmake_utils (at least) --
>> rebuild `kate`...
>>
>
> the problem never existed in those. as i said, it has to do with ZMQ,
> which is only used in ipython.
>
wrong!
the root of the problem laid in an object ownership idioms are clashed:
Python w/ GC vs. Qt (w/ QObject parents) vs. C++ (w/ destructors).
I've done a deep investigation about a month ago. that time I've found a
workaround/fix for that:
the plugin w/ a toolview **must** explicitly destroy it on unload. the
method has implemented as a "part" of MainWindow class and available only
to Python code. it helps to break a dependency in Python, then it uses Qt
way to destroy, which is finally calls a C++ destructor (after
deleteLater()).
the investigation was initiated by Shaheed in a private emails. same
(ownership) problem was discovered for `gid` plugin...
so, **rebuild P=E2t=EA and dive into to the color_tools/cmake_utils sources=
**.
hints: use thr `sip` module API (from Python) to discover a _true_ objects
ownership...
> and color_tools still throws an exception on unload:
>
> Exception AttributeError: "'MainWindow' object has no attribute
> 'destroyToolView'" in <bound method PaletteView.__del__ of
> <color_tools.color_palette.PaletteView object at 0x7f8ac811b808>> ignored
>
> _______________________________________________
> KWrite-Devel mailing list
> KWrite-Devel@kde.org
> https://mail.kde.org/mailman/listinfo/kwrite-devel
>
>
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 19, 2014 \
at 12:07 AM, Philipp A. <span dir="ltr"><<a href="mailto:flying-sheep@web.de" \
target="_blank">flying-sheep@web.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div \
class="gmail_quote">2014-02-18 19:15 GMT+01:00 Alex Turbov <span dir="ltr"><<a \
href="mailto:i.zaufi@gmail.com" \
target="_blank">i.zaufi@gmail.com</a>></span>:<div>
<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px \
solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">the problem already solved for color_tools and cmake_utils (at least) \
-- rebuild `kate`...<br></div></blockquote><div><br></div></div><div>the problem \
never existed in those. as i said, it has to do with ZMQ, which is only used in \
ipython.<br>
</div></div></div></div></blockquote><div><br></div><div>wrong!<br></div><div>the \
root of the problem laid in an object ownership idioms are clashed: Python w/ GC vs. \
Qt (w/ QObject parents) vs. C++ (w/ destructors).<br> </div>
<div>I've done a deep investigation about a month ago. that time I've found a \
workaround/fix for that:<br></div><div>the plugin w/ a toolview **must** explicitly \
destroy it on unload. the method has implemented as a "part" of MainWindow \
class and available only to Python code. it helps to break a dependency in Python, \
then it uses Qt way to destroy, which is finally calls a C++ destructor (after \
deleteLater()).<br> <br></div><div>the investigation was initiated by Shaheed in a \
private emails. same (ownership) problem was discovered for `gid` \
plugin...<br><br></div><div>so, **rebuild Pâtê and dive into to the \
color_tools/cmake_utils sources**.<br> <br></div><div>hints: use thr `sip` module API \
(from Python) to discover a _true_ objects \
ownership...<br><br></div><div><br></div><blockquote class="gmail_quote" \
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div \
dir="ltr"><div class="gmail_extra"><div class="gmail_quote"> <div>
<br></div><div>and color_tools still throws an exception on unload:<br><br>Exception \
AttributeError: "'MainWindow' object has no attribute \
'destroyToolView'" in <bound method PaletteView.__del__ of \
<color_tools.color_palette.PaletteView object at 0x7f8ac811b808>> \
ignored<br>
</div></div></div></div>
<br>_______________________________________________<br>
KWrite-Devel mailing list<br>
<a href="mailto:KWrite-Devel@kde.org" target="_blank">KWrite-Devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kwrite-devel" \
target="_blank">https://mail.kde.org/mailman/listinfo/kwrite-devel</a><br> \
<br></blockquote></div><br></div></div>
_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic