PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 855 - QApplication instance never gets cleaned up
: QApplication instance never gets cleaned up
Status: CLOSED INVALID
Product: PySide
Classification: Unclassified
Component: QtGui
: 1.0.2
: PC MS Windows XP/Vista/7
: P5 major
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-05-12 21:36 EEST by chriswillmorris
Modified: 2011-12-08 15:21 EET (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chriswillmorris 2011-05-12 21:36:06 EEST
Running a script more than once where a QApplication is created, without
restarting the Python IDLE shell, gives the following error:
A QApplication instance already exists.

sample code that can cause this issue (run this more than once):

from PySide.QtGui import QApplication
import sys

app = QApplication(sys.argv)
app.exec_()
Comment 1 Hugo Parente Lima 2011-05-12 21:40:47 EEST
You can have only one QApplication instance per process, using "del app" wont
kill the QApplication instance because there are others references to it like
the PySide.QtGui.qApp.
Comment 2 chriswillmorris 2011-05-13 01:12:15 EEST
Then how can I test out a program more than once?

While I am developing, I would like to:
1. run the program
2. observe its behavior
3. modify code
4. go to step 1


How is this currently possible without continually exiting python shell and
reentering it?
Comment 3 renato filho 2011-06-22 20:25:14 EEST
release 1.0.4
Comment 4 Matthias Bussonnier 2011-12-08 15:21:07 EET
Same problem, but why then does it work when using PyQt4?
I agree that there should be only one QApplication running, but you should be
able to construct another which replace the old one if the previous is exited.