[PyKDE] Another question, crash

Jim Bublitz jbublitz at nwinternet.com
Tue Jun 29 22:30:00 BST 2004


On Tuesday 29 June 2004 07:09, Ian Monroe wrote:
> OK, I've got another question I think it might (though hopefully not)
> be more complicated then the last one.Here is the relevant stuff
> again:
>
> in a class, is called when Configure Panel is selected. self._win is a
> MainWIn, self._prefs is a class derived from KConfigSkeleton. I've
> marked the point of the code where it crashes.
>
> 	def showSettings(self):
> 		if(KConfigDialog.showDialog("settings")):
> 			return
> 		dialog = SettingsDialog(self._win, "settings", self._prefs)
> 		print "and we're back"
> 		dialog.show() ##########<-------crashes here
> 		print "and we're crashed"
>
> And for the SettingsDialog call:
> class SettingsDialog(KConfigDialog):
> 	def __init__ (self, parent, name, config, *args):
> 		apply (KConfigDialog.__init__, (self,parent,name,config) + args)
>
> 		print isinstance(config,KConfigSkeleton)
> 		self.addPage(ConfigForm(config), "GMail", "gmail", "KNewGmail
>  Settings") print "finished"
>
> It crashes when Configure Settings is selected:
> finished
> and we're back
> KCrash: Application 'KNewGmail.py' crashing...
>
> I posted all the code at http://www2.truman.edu/~iam504/knewgmail.tar.bz2
> Other then the above bug, don't look at it too closely since I know
> there are probably other issues that I just haven't got to yet.
>
> The first release (which doesn't have any configure) is available here:
> http://www.kde-apps.org/content/show.php?content=13801

In TimeObject.__init__ you were calling the QThread ctor - I changed that to 
QObject to get KNewGmail.py to run.

The backtrace I get is:

#2  0x41bd1c22 in KCrash::defaultCrashHandler ()
   from /opt/kde3/lib/libkdecore.so.4
#3  0x40125e31 in __pthread_sighandler () from /lib/libpthread.so.0
#4  <signal handler called>
#5  0x40206ef1 in __dynamic_cast () from /usr/lib/libstdc++.so.5
#6  0x41b4cf37 in KConfigDialogManager::property ()
   from /opt/kde3/lib/libkdecore.so.4
#7  0x41bc1ff2 in KConfigDialogManager::updateWidgets ()
   from /opt/kde3/lib/libkdecore.so.4
#8  0x428d4e75 in KConfigDialog::show () from /opt/kde3/lib/libkdeui.so.4
#9  0x42184580 in sipKConfigDialog::show ()
   from /usr/lib/python2.3/site-packages/libkdeuicmodule.so

Apparently one of the dynamic_cast (#5 above) calls in 
KConfigDialogManager::property() (in the C++ lib, not in PyKDE) is causing 
the problem. The KConfigDialogManager instance is owned by KConfigDialog and 
is private, so you can't access it from PyKDE.

If I comment out both of the KLineEdit instances, the problem goes away. It 
also goes away if I comment out the related addItemString calls in 
configForm.py (addItemString appears to work correctly, as does KLineEdit).  
Changing the KLineEdits to QLineEdits makes no difference. Neither does 
substituting fixed strings for the "prefs.get*()" calls.

I also don't see the QSpinBox when I do get the dialog to pop up, but haven't 
looked into that much.

A couple points that probably aren't relevant: you're using qApp.translate() - 
KDE uses i18n. I'd also review the docs (kconfigdialogmanager.h) about 
QSqlProperty stuff - I'm not sure that's a problem, but I'm not sure it 
isn't.

As far as I can tell, it's not a PyKDE problem - PyKDE seems to be doing 
everything it's supposed to do. I guess I'd try some/all of a few things 
next:

1. Throw out everything except the KConfig related stuff - esp try to get it 
working without threading first, and then add the threading back in.

2. Try sip4 if you're not already using it (need to rebuild sip, PyQt and 
PyKDE in that case) - I'll try that later if I get a chance.

3. Checkout some KDE C++ code that does this and see if they do anything 
differently.

4. Try a C++ implementation of the KConfig stuff and see if it actually works 
there.

5. Try attaching a debugger and see if you can figure out why the dynamic_cast 
in KConfigDialogManager is crashing (you'll probably need a debug version of 
libkdecore.so). Alternatively, add some printfs or other diagnostics to 
kconfigdialogmanager.cpp.

I'm going to try to get to (1) over the next few days as I'd like to make sure 
PyKDE is correct, and an example program would be worthwhile as well.

Sorry I don't have a fix for this.

Jim





More information about the PyQt mailing list