[PyKDE] Found cure for bizarre backtrace - ???
phil at river-bank.demon.co.uk
Tue Jul 2 18:52:01 BST 2002
Bill Soudan wrote:
> On Tue, 2 Jul 2002, Bill Soudan wrote:
>>I'm going to do some more debugging today. If I can't find anything else
>>out about the exception, I'll prune the code down and post it.
> Alright, I've narrowed the culprit down to my subclassed QListViewItem.
> I add a single MonitorItem to the listview, send rapid-fire XMLRPC
> messages to the GUI, and when I click on the item, the exception occurs.
> class MonitorItem(QListViewItem):
> def __init__(self, host, port, parent = None, name = None):
> QListViewItem.__init__(self, parent, name)
> def text(self, column):
> return 'test'
> I've found two different ways to get rid of the dump:
> 1) don't override the text method. Not really practical.
> 2) modify the text method to return QString('text') instead of just 'text'.
> I always thought PyQt is supposed to convert between Python strings and
> QStrings automatically. I reviewed the docs though and they don't
> specifically say whether returning Python strings from C++ methods is
> acceptable, nor does QListViewItem have any caveats listed. So is #2 the
> proper fix?
No, you shouldn't need to do it - it should be done for you. The
generated code that does it is sipForceConvertTo_QString() and
sipConvertTo_QString(). Your #2 means a different code path is taken in
the latter function.
I think the exception is a false one. Try the following fix to
sipTransferSelf() in siplib.c (the comment just above this code gives
if ((sipThis = sipMapSelfToThis(sipSelf)) != NULL)
>>> Add the following two lines <<<
More information about the PyQt