[vlc-commits] Script intended to reproduce a GC related issue
Olivier Aubert
git at videolan.org
Wed Feb 4 16:48:50 CET 2015
vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Wed Feb 4 11:32:16 2015 +0100| [7b31ac6ddfe9d1f2051349974d08621785cb3771] | committer: Olivier Aubert
Script intended to reproduce a GC related issue
> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=7b31ac6ddfe9d1f2051349974d08621785cb3771
---
tests/gctest.py | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/tests/gctest.py b/tests/gctest.py
new file mode 100755
index 0000000..4966b3f
--- /dev/null
+++ b/tests/gctest.py
@@ -0,0 +1,31 @@
+#! /usr/bin/python
+
+"""Script checking for garbage collection issues with event handlers.
+
+See https://github.com/oaubert/python-vlc/issues/2
+
+This currently should exhibit the reported issue.
+"""
+
+import sys
+import vlc
+import time
+import gc
+
+i = vlc.Instance()
+p = vlc.MediaPlayer()
+
+def poschanged(foo):
+ print "poschanged"
+
+for n in range(10):
+ p.stop()
+ p.set_media(i.media_new(sys.argv[1]))
+ em = p.event_manager()
+ em.event_attach(vlc.EventType.MediaPlayerPositionChanged, poschanged)
+ p.play()
+ time.sleep(.5)
+ p.pause()
+ gc.collect()
+ p.pause()
+ time.sleep(.5)
More information about the vlc-commits
mailing list