[PyKDE] crashes in eric/python

Andrew Bushnell awb at fluent.com
Fri Apr 8 20:13:02 BST 2005


The latest snapshots of eric are crashing for me when I try and use eric 
to debug any script.  I have been looking into it today and have found 
what the culprit appears to be. I am going to provide a snippet of code 
to explain what I am seeing and see if there is anyone has any thoughts 
on what is going on.

To begin with I am using the following versions:

Python	2.3.3
Qt	3.2.2
PyQt	3.8.1
OS	Windows XP

the particular crash I am seeing in Eric is I can launch eric, open a 
python script, then from the debug menu, select Debug script. The dialog 
opens to prompt for working directory etc., when I select ok, my 
python.exe that is running eric crashes on windows and eric 
disappears... With some probing and debugging, I have closed it down to 
what appears to be a garbage/memory collection issue in python, 
specifically in the latest eric snapshot in the code for the getData 
method of the StartDialog (in the eric source base it is in 
Debugger\StartDialog.py

the current getData looks like:

     def getData(self):
         return (self.cmdlineCombo.currentText().replace(os.linesep, ""),
             self.workdirCombo.currentText().replace(os.linesep, ""),
             self.environmentCombo.currentText().replace(os.linesep, ""),
             self.exceptionCheckBox.isChecked())

where self is the StartDialog which is a QDialog instance.
cmdlineCombo is a QComboBox instance
workdirCombo is a QComboBox instance
environmentCombo is a QComboBox instance
exceptionsCheckBox is a QCheckButton

Anyway, when accessing any of the textdata from this returned tuple, the 
application crashes. In inspecting the data with the limited debug 
information I have, the basic problem is data seems to have been 
"trashed"/delete etc.

Now if I change the above code to read as follows:
     def getData(self):
         cmdLine = self.cmdlineCombo.currentText()
         cmdLine = cmdLine.replace(os.linesep, "")
         workdir = self.workdirCombo.currentText()
         workdir.replace(os.linesep, "")
         environ = self.environmentCombo.currentText()
         environ.replace(os.linesep, "")
         return (cmdLine,
                 workdir,
                 environ,
                 self.exceptionCheckBox.isChecked())


Then eric works just fine and I have no crashes.  It seems I have to 
make the local python reference to the QString from currentText before 
trying to replace and return the reference to it. Does this  make sense? 
I know  we have somewhat old versions of qt/pyqt so could this have been 
something changed in the latest versions of qt/pyqt?

Thanks in advance for any insight,


-- 
************************************
Andrew Bushnell
Lead Development Engineer
Fluent Inc.
10 Cavendish Court
Centerra Resource Park
Lebanon, NH  03766
awb at fluent.com
Phone: 603-643-2600, ext. 757
Fax: 603-643-1721
www.fluent.com
************************************




More information about the PyQt mailing list