Permalink
Browse files

BF: fixed a memory leak for MovieStim3

  • Loading branch information...
peircej committed Aug 13, 2018
1 parent eadf758 commit 9d0c127d8e6dfd6efba5f285bed93685980cd443
Showing with 6 additions and 8 deletions.
  1. +2 −1 psychopy/visual/basevisual.py
  2. +4 −7 psychopy/visual/movie3.py
@@ -999,7 +999,8 @@ def clearTextures(self):
of your stimulus, so doesn't need calling explicitly by the user.
"""
GL.glDeleteTextures(1, self._texID)
GL.glDeleteTextures(1, self._maskID)
if hasattr(self, '_maskID'):
GL.glDeleteTextures(1, self._maskID)
@attributeSetter
def mask(self, value):
View
@@ -38,7 +38,7 @@
from psychopy import logging, prefs #adding prefs to be able to check sound lib -JK
from psychopy.tools.arraytools import val2array
from psychopy.tools.attributetools import logAttrib, setAttribute
from psychopy.visual.basevisual import BaseVisualStim, ContainerMixin
from psychopy.visual.basevisual import BaseVisualStim, ContainerMixin, TextureMixin
from moviepy.video.io.VideoFileClip import VideoFileClip
@@ -50,7 +50,7 @@
import pyglet.gl as GL
class MovieStim3(BaseVisualStim, ContainerMixin):
class MovieStim3(BaseVisualStim, ContainerMixin, TextureMixin):
"""A stimulus class for playing movies (mpeg, avi, etc...) in PsychoPy
that does not require avbin. Instead it requires the cv2 python package
for OpenCV. The VLC media player also needs to be installed on the
@@ -467,11 +467,8 @@ def _getAudioStreamTime(self):
return self._audio_stream_clock.getTime()
def _unload(self):
try:
# remove textures from graphics card to prevent crash
self.clearTextures()
except Exception:
pass
# remove textures from graphics card to prevent crash
self.clearTextures()
if self._mov is not None:
self._mov.close()
self._mov = None

0 comments on commit 9d0c127

Please sign in to comment.