Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 871a97a

Browse files
Update backend_qt5agg to fix PySide2 mem issues
Pyside2 seems to have the same issue as PySide where the QImage data reference is incorrect and needs to be adjusted for the Python garbage collector.
1 parent 10ffa53 commit 871a97a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def paintEvent(self, event):
6464
painter.drawImage(origin / self._dpi_ratio, qimage)
6565
# Adjust the buf reference count to work around a memory
6666
# leak bug in QImage under PySide on Python 3.
67-
if QT_API == 'PySide':
67+
if QT_API in ('PySide', 'PySide2'):
6868
ctypes.c_long.from_address(id(buf)).value = 1
6969

7070
self._draw_rect_callback(painter)

0 commit comments

Comments
 (0)