From 1a9a5552ac7103bfea5ba37d5cea87a5452b83ab Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Tue, 11 Sep 2018 12:00:56 -0700 Subject: [PATCH] Backport PR #12092: Update backend_qt5agg to fix PySide2 mem issues --- lib/matplotlib/backends/backend_qt5agg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_qt5agg.py b/lib/matplotlib/backends/backend_qt5agg.py index f0268299bad4..826156e67843 100644 --- a/lib/matplotlib/backends/backend_qt5agg.py +++ b/lib/matplotlib/backends/backend_qt5agg.py @@ -63,7 +63,7 @@ def paintEvent(self, e): qimage = QtGui.QImage(buf, w, h, QtGui.QImage.Format_ARGB32) # Adjust the buf reference count to work around a memory leak bug # in QImage under PySide on Python 3. - if QT_API == 'PySide' and six.PY3: + if QT_API in ('PySide', 'PySide2') and six.PY3: ctypes.c_long.from_address(id(buf)).value = 1 if hasattr(qimage, 'setDevicePixelRatio'): # Not available on Qt4 or some older Qt5.