[vlc-devel] [PATCH] Mediaplayer.java in JavaBinding causes a crash on windows

Ulrik Einarson torvalde at gmail.com
Tue Mar 3 04:42:31 CET 2009


 When setting up the event listeners the range
 LibVlcEventType.libvlc_MediaPlayerPlaying to
LibVlcEventType.libvlc_MediaPlayerTimeChanged
 was used but when detaching them the range
 LibVlcEventType.libvlc_MediaPlayerPlaying to
LibVlcEventType.libvlc_MediaPlayerPositionChanged
 was used this can result in a crash at least on windows, updated them to be
in sync

I also added a callbacks.clear after the detach, for symmetry
---
 .../main/java/org/videolan/jvlc/MediaPlayer.java   |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git
a/bindings/java/core/src/main/java/org/videolan/jvlc/MediaPlayer.java
b/bindings/java/core/src/main/java/org/videolan/jvlc/MediaPlayer.java
index 8590e46..db6a594 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/MediaPlayer.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/MediaPlayer.java
@@ -195,11 +195,12 @@ public class MediaPlayer
         {
             for (LibVlcEventType event : EnumSet.range(
                 LibVlcEventType.libvlc_MediaPlayerPlaying,
-                LibVlcEventType.libvlc_MediaPlayerPositionChanged))
+                LibVlcEventType.libvlc_MediaPlayerTimeChanged))
             {
                 libvlc.libvlc_event_detach(eventManager, event.ordinal(),
callback, null, exception);
             }
         }
+        callbacks.clear();
         libvlc.libvlc_media_player_release(instance);

     }
-- 
1.6.1.9.g97c34
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090303/7738aa66/attachment.html>


More information about the vlc-devel mailing list