[PyQt] PyQt 3.18.1 qApp.translate() issues since sip 4.11.1 (at least)

Hans-Peter Jansen hpj at urpla.net
Wed Oct 6 13:33:29 BST 2010


Hi Phil,

today, I noticed, that there's an ugly issue, resulting in such tracebacks:

Traceback (most recent call last):
  File "main.py", line 84, in <module>
    win = MainWin()
  File "mainwin.py", line 25, in __init__
    MainWinBase.__init__(self, parent, name, fl)
  File "mainwinbase.py", line 44, in __init__
    self.ladelisteToolbar = DbToolbar(LayoutWidget_2,"ladelisteToolbar")
  File "dbtoolbar.py", line 17, in __init__
    DbToolbarBase.__init__(self, parent, name, fl)
  File "dbtoolbarbase.py", line 79, in __init__
    self.languageChange()
  File "dbtoolbarbase.py", line 95, in languageChange
    QToolTip.add(self.pbFindClear,self.__trUtf8("\x53\x75\x63\x68\x74\x65\x78\x74\x20\x6c\xc3\xb6\x73\x63\x68\x65\x6e"))
  File "dbtoolbarbase.py", line 112, in __trUtf8
    return qApp.translate("DbToolbarBase",s,c,QApplication.UnicodeUTF8)
RuntimeError: underlying C/C++ object has been deleted

Traceback (most recent call last):
  File "artikeltable.py", line 48, in updateArtikel
    self._artikelEdit = ArtikelEdit(self, self)
  File "artikeledit.py", line 18, in __init__
    ArtikelEditBase.__init__(self, parent, name)
  File "artikeleditbase.py", line 240, in __init__
    self.languageChange()
  File "artikeleditbase.py", line 260, in languageChange
    self.setCaption(self.__tr("Artikel Editor"))
  File "artikeleditbase.py", line 302, in __tr
    return qApp.translate("ArtikelEditBase",s,c)
RuntimeError: underlying C/C++ object has been deleted

Traceback (most recent call last):
  File "dbtoolbar.py", line 141, in toggleFilter
    qApp.mainWidget().updateStatus()
RuntimeError: underlying C/C++ object has been deleted

As you can see, qApp is always involved, translate() most of the time, too.
The real ugliness comes from not being reproducible, the same code happens
to run perfectly well on the next try, and I was not able to create a 
minimum example, yet.

I do know for sure, that this doesn't happen with sip 4.10.1, hence it's 
something, that crawled in between 4.10.1 and 4.11.1. Does this ring a bell
for you?

I noticed, that PyQt3 wraps QApplication.translate() as an ordinary method, 
whereas QCoreApplication.translate always capsule the translation result in
a "new QString()". Is that probably related?

Pete


More information about the PyQt mailing list