File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def paintEvent(self, e):
7575 # FigureCanvasQT.paintEvent(self, e)
7676 if DEBUG :
7777 print ('FigureCanvasQtAgg.paintEvent: ' , self ,
78- self .get_width_height ())
78+ self .get_width_height ())
7979
8080 if self .blitbox is None :
8181 # matplotlib is in rgba byte order. QImage wants to put the bytes
@@ -125,6 +125,10 @@ def paintEvent(self, e):
125125 stringBuffer = reg .to_string_argb ()
126126 qImage = QtGui .QImage (stringBuffer , w , h ,
127127 QtGui .QImage .Format_ARGB32 )
128+ # Adjust the stringBuffer reference count to work around a memory
129+ # leak bug in QImage() under PySide on Python 3.x
130+ ctypes .c_long .from_address (id (stringBuffer )).value = 1
131+
128132 pixmap = QtGui .QPixmap .fromImage (qImage )
129133 p = QtGui .QPainter (self )
130134 p .drawPixmap (QtCore .QPoint (l , self .renderer .height - t ), pixmap )
You can’t perform that action at this time.
0 commit comments