[PyQt] Crash in frozen PyQt5 app
Hi, When running the following test app on OSX (10.8.4, PyQt 5.1 snapshot + Qt 5.1.1) https://github.com/pyinstaller/pyinstaller/blob/develop/tests/interactive/test_pyqt5_qml.py I get a crash when it is frozen using PyInstaller but not when it is not frozen. The crash occurs in QQuickView::setSource(...) A stack trace for a very similar test app is here http://pastebin.com/ZhqZFPxG Inspecting it in the debugger shows that the cause of the crash is that QCoreApplication::instance() returns 0 and in the stack trace shows the abort caused by a Q_ASSERT that I put in to check that. Any ideas about what could be happening here? Glenn ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Crash in frozen PyQt5 app
On Fri, 30 Aug 2013 15:13:29 +1200, Glenn Ramsey g...@componic.co.nz wrote: Hi, When running the following test app on OSX (10.8.4, PyQt 5.1 snapshot + Qt 5.1.1) https://github.com/pyinstaller/pyinstaller/blob/develop/tests/interactive/test_pyqt5_qml.py I get a crash when it is frozen using PyInstaller but not when it is not frozen. The crash occurs in QQuickView::setSource(...) A stack trace for a very similar test app is here http://pastebin.com/ZhqZFPxG Inspecting it in the debugger shows that the cause of the crash is that QCoreApplication::instance() returns 0 and in the stack trace shows the abort caused by a Q_ASSERT that I put in to check that. Any ideas about what could be happening here? No, but a comment on the use of global app in the code... The effect of that is to impose some order on the garbage collection of Python objects. When main() returns the local objects get garbage collected in an arbitrary order. If that order is wrong as far as Qt is concerned then you get undefined behaviour or a crash. Specifying app as a global means that it will get garbage collected later. Personally I never use a main() function and put the code at the module level under if __name__ == '__main__'. It should only be a few lines anyway. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Simple patch for pylupdate4
Hello, The following trivial patch to pylupdate/fetchtr.cpp (for PyQt 4.10.3) allows pylupdate4 to correctly process backslashes at the end of a line, instead of replacing such backslashes with a linefeed (ASCII 10) character. This is very useful in triple-quoted strings to avoid introducing newlines that don't exist in the original Python string. (this is *not* about \n sequences; these work fine, having an identical counterpart in C++ syntax) Unfortunately, the patch only works for Python source files that have Unix-style line endings, but doesn't make things any worse for other newline styles. Ideally, Python source files would be read in some kind of universal newlines mode... Could you please include it, or something similar? Thanks. -- Florent --- a/pylupdate/fetchtr.cpp +++ b/pylupdate/fetchtr.cpp @@ -342,7 +342,8 @@ yyString[yyStringLen++] = (char) n; } else { const char *p = strchr( tab, yyCh ); -if ( yyStringLen sizeof(yyString) - 1 ) +if ( yyStringLen sizeof(yyString) - 1 + yyCh != '\n' ) yyString[yyStringLen++] = ( p == 0 ) ? (char) yyCh : backTab[p - tab]; yyCh = getChar(); ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt