Skip to content

Commit 21bc6b2

Browse files
committed
Fixed Python crash occuring at exit when deleting objects (Python 3 only)
1 parent 1b3e154 commit 21bc6b2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

qwt/plot.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""
2121

2222
from .qt.QtGui import (QWidget, QFont, QSizePolicy, QFrame, QApplication,
23-
QRegion, QPainter, QPalette)
23+
QPainter, QPalette)
2424
from .qt.QtCore import Qt, Signal, QEvent, QSize, QRectF
2525

2626
from .text import QwtText, QwtTextLabel
@@ -355,12 +355,14 @@ def __init__(self, *args):
355355
qwtEnableLegendItems(self, True)
356356

357357
def __del__(self):
358-
#XXX Is is really necessary in Python? (pure transcription of C++)
359358
self.setAutoReplot(False)
360-
self.detachItems(QwtPlotItem.Rtti_PlotItem, self.autoDelete())
361-
self.__data.layout = None
362-
self.deleteAxesData()
363-
self.__data = None
359+
#XXX Is is really necessary in Python? (pure transcription of C++)
360+
# The following line have been commented to avoid crashing Python
361+
# when exiting interpreter (Python 3 only)
362+
# self.detachItems(QwtPlotItem.Rtti_PlotItem, self.autoDelete())
363+
# self.__data.layout = None
364+
# self.deleteAxesData()
365+
# self.__data = None
364366

365367
def initAxesData(self):
366368
"""Initialize axes"""

0 commit comments

Comments
 (0)