Skip to content

Update patched-6 branch #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from

Conversation

mwoehlke-kitware
Copy link
Contributor

@mwoehlke-kitware mwoehlke-kitware commented May 24, 2016

This is a rebase of the more recent patched-5 commits onto the patched-6 branch (which has a linear svn history, rather than svn commits interspersed with git commits as on patched-5), plus an additional patch to fix a link error.

A fast-forward merge may be preferable...

msmolens and others added 14 commits May 23, 2016 11:48
This commit prevents crashes by handling scenarios such as:
(a) object destruction after the Python interpreter has been finalized
(b) object destruction after cleanup, i.e. the singleton no longer exists

Any usage of a Qt enum demonstrates (a).

One example that demonstrates (b) is a QTimer object which is created with a
QApplication parent. PythonQt::cleanup() is called before the QApplication is
completely destroyed, so the code that handles wrapping the QTimer object must
handle the case when the PythonQt singleton no longer exists.

Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
This commit fixes a link error building PythonQtCppTests on Windows:

    1>PythonQtCppTests.obj : error LNK2001: unresolved external symbol "int __cdecl tests_PythonQtTestMain(int,char * * const)" (?tests_PythonQtTestMain@@YAHHQEAPEAD@Z)
    1>C:\temp\PythonQt-build\Debug\PythonQtCppTests.exe : fatal error LNK1120: 1 unresolved externals
A sequence of calls like the following would crash in Python when reinitializing
the interpreter the second time:

    PythonQt::init(0);
    ...
    Py_Finalize();

    PythonQt::init(0);
    ...
    Py_Finalize();
This commit changes initialization of the global storage containers to be
explicit instead of happening during static initialization. This makes the
containers properly initialized if PythonQt is initialized and cleaned up more
than once.

The motivation for this change is to support testing cleanup and finalization.
Add tests that check for clean cleanup and finalization in different scenarios.

Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
Co-authored-by: Pat Marion <[email protected]>
This commit fixes a crash during PythonQt::cleanup(). While destroying the
PythonQtPrivate instance, any remaining PythonQtSignalReceivers that are kept
alive only by their parent object will be destroyed. The crash occurs when
PythonQtSignalReceiver's destructor calls back into
PythonQtPrivate::removeSignalEmitter() when the PythonQtPrivate instance is
mostly destroyed.

Includes test case that crashes without the fix.
This commit fixes the following link error:

PythonQtTestMain.cpp:(.text+0x1637): undefined reference to `PythonQtTestCleanup::~PythonQtTestCleanup()'
This will allow to easily add new exceptions when adding support
for Qt5..
Based on work from the following individual:
 * Melven Röhrig-Zöllner (https://sourceforge.net/p/pythonqt/discussion/631392/thread/5f20c176/)
 * Julien Finet (@finetjul): See commontk#38)
 * Arnaud Barre (@Alzathar):See commontk#15
 * Eric Heim (@eric-h):See commontk#36
@jcfr
Copy link
Member

jcfr commented May 24, 2016

Thanks Matt.

I will have a look tmrw and integrate.

In the mean time, I wonder if it would make sense to do a svn rebase
against the current trunk of PythonQt

Jc
On May 24, 2016 1:48 PM, "Matthew Woehlke" [email protected] wrote:

This is a rebase of the more recent patched-5 commits onto the patched-6
branch (which has a linear svn history, rather than svn commits
interspersed with git commits as on patched-5).

A fast-forward merge may be preferable...

You can view, comment on, or merge this pull request online at:

#44
Commit Summary

  • Update README.md to describe new commits
  • Prevent crashes during and after cleanup
  • Fix tests link error on Windows
  • Fix refcount problems seen when re-initializing Python after
    finalizing
  • Explicitly initialize global storage containers
  • Add cleanup/finalization tests
  • Fix PythonQtSignalReceiver crash during cleanup
  • Fix compilation of test when PythonQt_Wrap_Qtcore option is disabled
  • Remove unused call to qt4_wrap_ui/qt4_add_resources associated with
    PythonQt library
  • Add macro pythonqt_wrap_cpp removing the need for qt version
    specific macros
  • Re-factor code introducing qt_wrapped_libs variable
  • Refactor handling of "generated_cpp_suffix".
  • Add support for Qt5

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#44

@jcfr
Copy link
Member

jcfr commented May 30, 2016

Thanks again for the PR 👍

Integrated in 56550e4

@jcfr jcfr closed this May 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants