ScatterPlotItem: Fix a GC memory leak due to numpy issue 6581
This commit is contained in:
parent
ee0877170d
commit
b3a579fd00
@ -857,11 +857,18 @@ class SpotItem(object):
|
||||
def __init__(self, data, plot):
|
||||
#GraphicsItem.__init__(self, register=False)
|
||||
self._data = data
|
||||
self._plot = plot
|
||||
# SpotItems are kept in plot.data["items"] numpy object array which
|
||||
# does not support cyclic garbage collection (numpy issue 6581).
|
||||
# Keeping a strong ref to plot here would leak the cycle
|
||||
self.__plot_ref = weakref.ref(plot)
|
||||
#self.setParentItem(plot)
|
||||
#self.setPos(QtCore.QPointF(data['x'], data['y']))
|
||||
#self.updateItem()
|
||||
|
||||
@property
|
||||
def _plot(self):
|
||||
return self.__plot_ref()
|
||||
|
||||
def data(self):
|
||||
"""Return the user data associated with this spot."""
|
||||
return self._data['data']
|
||||
|
Loading…
Reference in New Issue
Block a user