Re: [PyQt] [PyKDE] KCrash, sometimes even glibc
On Monday 27 August 2007, Phil Thompson wrote: Crashes on exit have two causes... - PyQt bugs related to object ownership - C++ objects being deleted in the wrong order (because Python objects are being garbage collected in a fairly random order). To debug these... - Always use current SIP and PyQt snapshots. They're as new as possible. - Strip your application down to the bare minimum while still demonstrating the problem - I would expect no more than 100 lines. This is really really tough. Haven't got around to it yet. But there must be something funky about the way I open windows. There are a few things I could/should use Dialogs for instead of MainWindows, but for one, the friendlist window might get a menu bar at some point and that is something that in my eyes isn't a dialog :) That aside, I don't think the two things are much different as far as widget ownership and closing them goes... I found that setting WDestructiveClose destroys the C++ but not the Python object, which makes for a good deal of runtime errors. If I don't WDC them, then I have to call .close() on the windows in the main window's queryClose() else we get stuck with hidden windows (apparently clicking the X button just hides these KMainWindows) and an app that's unable to exit. Is there anything special I should be writing in __del__() or anywhere else? Here's how I make the friendlist window from the event editor (happens when someone presses Ctrl+F): def editFriends(self): if not hasattr(self,friendeditorWindow) or self.friendeditorWindow is None: self.friendeditorWindow = ljkkdefriendeditor.LJKFriendEditor(self, ljklient:friendeditor, Qt.WType_TopLevel) self.friendeditorWindow.show() and the queryClose stuff in eventeditor: def queryClose(self): if hasattr(self, friendeditorWindow) and self.friendeditorWindow is not None: self.friendeditorWindow.close(True) if hasattr(self, previewWindow) and self.previewWindow is not None: self.previewWindow.close(True) return True def queryExit(self): if app.ljConn.hasSession(): app.ljConn.doLogout() return True If this is right, then I guess it's something inside LJKFriendEditor that I'm doing very wrong. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Crash in KMainWindow.saveProperties() [small sample C++/Python code provided]
Hello. I'm getting the same backtrace as mentioned in [1]. Please find attached a minimal C++ example application that successfully saves its state, and a Python equivalent that crashes when logging out of KDE. Note that the crash is not related to using config, just providing an empty saveProperties() crahses as well. [1] http://www.riverbankcomputing.com/pipermail/pyqt/2007-February/015426.html Cheers, -- Adeodato Simó dato at net.com.org.es Debian Developer adeodato at debian.org We may not return the affection of those who like us, but we always respect their good judgement. #include kapplication.h #include kcmdlineargs.h #include kmainwindow.h #include kconfig.h class MainWindow : public KMainWindow { Q_OBJECT; public: MainWindow() {} ~MainWindow() {} void saveProperties(KConfig *); }; void MainWindow::saveProperties(KConfig *config) { config-writeEntry(foo, bar); } int main (int argc, char **argv) { KCmdLineArgs::init(argc, argv, test, test, test, 1.0); KApplication app; MainWindow *window = new MainWindow; app.setTopWidget(window); window-show(); return app.exec(); } #include session_moc.cc #! /usr/bin/env python import sys import kdeui import kdecore def main(): kdecore.KCmdLineArgs.init(sys.argv, 'test', 'test', 'test', '1.0') application = kdecore.KApplication() main_window = MainWindow() main_window.show() application.exec_loop() class MainWindow(kdeui.KMainWindow): def saveProperties(self, config): config.writeEntry('foo.py', 'bar.py') if __name__ == '__main__': main() ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Crash in KMainWindow.saveProperties() [small sample C++/Python code provided]
On Tuesday 28 August 2007 11:10, Adeodato Simó wrote: Hello. I'm getting the same backtrace as mentioned in [1]. Please find attached a minimal C++ example application that successfully saves its state, and a Python equivalent that crashes when logging out of KDE. Note that the crash is not related to using config, just providing an empty saveProperties() crahses as well. It doesn't crash here (just running the simple app you attached), so I can't actually test a solution, but Simon Edwards ran into a similar problem with PyKDE4 and fixed it by globally declaring 'application' (from your example): application = None and then inside main(), adding: global application I think that should ensure that KApplication is the last object destroyed. The other possibility is to construct the main window and KApplication in global space, after the if __name__ == __main__ test, instead of putting them inside a function or class method. That seems to have fewer problems with exit crashes (but other things can cause them as well). As has been noted, the crash probably has to do with the order in which objects are destroyed. PyKDE at one time tried to addressed this (probably with code stolen from PyQt) - it gets to be a problem as KDE/Qt change and possibly even as gcc/g++ changes it's exit code for C++. It also can cause problems with queryClose/queryExit methods in KApplication, and with session management. Jim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Crash in KMainWindow.saveProperties() [small sample C++/Python code provided]
* Jim Bublitz [Tue, 28 Aug 2007 12:56:19 -0700]: On Tuesday 28 August 2007 11:10, Adeodato Simó wrote: Hello. I'm getting the same backtrace as mentioned in [1]. Please find attached a minimal C++ example application that successfully saves its state, and a Python equivalent that crashes when logging out of KDE. Note that the crash is not related to using config, just providing an empty saveProperties() crahses as well. It doesn't crash here (just running the simple app you attached), so I can't actually test a solution, Oh, and what could be different? Can you test with xsm to see if it helps? (I guess you're familiar with xsm, but just in case: echo xterm ~/.xsmstartup; xsm; ./saveProperties.py from that xterm; select shutdown - with checkpoint - foo). Do you think there's a chance a newer version of PyKDE could help? but Simon Edwards ran into a similar problem with PyKDE4 and fixed it by globally declaring 'application' (from your example): application = None and then inside main(), adding: global application I think that should ensure that KApplication is the last object destroyed. I'm afraid this didn't help. The other possibility is to construct the main window and KApplication in global space, after the if __name__ == __main__ test, instead of putting them inside a function or class method. That seems to have fewer problems with exit crashes (but other things can cause them as well). Nor this. In any case, thanks for your help. -- Adeodato Simó dato at net.com.org.es Debian Developer adeodato at debian.org In my opinion, the most fruitful and natural play of the mind is in conversation. I find it sweeter than any other action in life; and if I were forced to choose, I think I would rather lose my sight than my hearing and voice. -- Michel de Montaigne ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Help on resizing a custom widget
David Boddie wrote: It sounds like you have a widget in a dialog, but you're not using a layout manager, so nothing is resizing the widget. I wrote a tutorial for EuroPython last year that covered the basic principles of PyQt: http://indico.cern.ch/contributionDisplay.py?contribId=33sessionId=41confId=44 Thanks for the reply and for pointing me into the right direction. Your tutorial is very good and got me started. The problem I'm having with the built-in layout managers is that I have a very specific layout that I want and the managers are wrecking it. Well, they're doing what they're supposed to do. So it looks like I'll be reimplementing QWidget::resizeEvent() and Qwidget::event(), as per http://doc.trolltech.com/4.3.0/layout.html#manual-layout. I have a question regarding QWidget::event(). The docs say to reimplement event() to handle QEvent::LayoutRequest. That's straightforward, but how do I want to handle that request? Should I be returning something there and, if so, what do I return for a manual layout? Newcomers to PyQt who prefer printed materials should note that a book on PyQt programming will be available in the near future: http://qtrac.eu/pyqtbook.html I did indeed notice that book in my searches...was flabbergasted when I realized that it hadn't been published yet. :confused: -- View this message in context: http://www.nabble.com/Help-on-resizing-a-custom-widget-tf4337591.html#a12375767 Sent from the PyQt mailing list archive at Nabble.com. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Crash in KMainWindow.saveProperties() [small sample C++/Python code provided]
* Adeodato Simó [Tue, 28 Aug 2007 22:30:36 +0200]: Do you think there's a chance a newer version of PyKDE could help? Oh my. I built 3.16 from source (it's not in Debian yet, I'm afraid) and it... works! Thanks for confirming it worked for you, which triggered me to build the new version. :) Cheers, -- Adeodato Simó dato at net.com.org.es Debian Developer adeodato at debian.org Puede ser que yo llegue tarde pero qué mas da si tu no me esperas -- Miguel Bosé, A millones de km de aquí ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] PyQt4.3 and stackless python 2.5.1 working?
Hi list, I recently played around a little bit with stackless python and also wanted to try it together with PyQt to see how lightweight threading works. The problem is that it look like stackless and pyqt4 do not like each other very much. from PyQt4 import QtCore gives me a Bus error under Macosx. I searched on the internet but did not find anything but someone mentioning that PyQt might be binary incompatible with stackless python. So I downloaded the current stable sip and PyQt compiled it with stackless python but the bus error persists. I am not sure if this is a pyqt or stackless problem so I am just asking if someone is using stackless+pyqt without any problems. Kind regards, Michael ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] sip segfaults while using eric4
Phil Thompson wrote: Ok, I found a pretty quick way to crash it. * You open eric4. * Go to Project- Version Control - New From Repository * Select Subversion(svn) * Hit Ok and voila, it crashes (at least for me). I still can't reproduce it. Well, I can reproduce it on a clean RHEL 4 installation. Version Numbers: Python 2.5.1 Qt 4.3.1 PyQt4 4.3 sip 4.7 QScintilla 2-snapshot-20070812 eric4 4.1-snapshot-20070813 (r1433) Platform: linux2 2.5.1 (r251:54863, Aug 28 2007, 08:32:12) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] All I did was to play around in Go to Project- Version Control - New From Repository it did not happen the first time, but after a while it did. It also didn't matter which type of VCS I use. CVS crashes as well as SVN. Christof ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt