[vlc-devel] commit: protect from null options param, and finalize added ( Filippo Carone )
git version control
git at videolan.org
Wed Apr 9 00:32:02 CEST 2008
vlc | branch: master | Filippo Carone <littlejohn at videolan.org> | Tue Apr 8 23:42:42 2008 +0200| [21ca9ddb286c5c95059dbbcb9c24364e250a3d96]
protect from null options param, and finalize added
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=21ca9ddb286c5c95059dbbcb9c24364e250a3d96
---
.../core/src/main/java/org/videolan/jvlc/VLM.java | 29 ++++++++++++++++---
1 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java b/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java
index 4f4c416..7763726 100644
--- a/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java
+++ b/bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java
@@ -30,7 +30,10 @@ import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
public class VLM
{
+
private JVLC jvlc;
+
+ private volatile boolean released;
public VLM(JVLC jvlc)
{
@@ -45,7 +48,7 @@ public class VLM
name,
input,
output,
- options.length,
+ options == null ? 0 : options.length,
options,
enabled ? 1 : 0,
loop ? 1 : 0,
@@ -102,7 +105,7 @@ public class VLM
name,
input,
output,
- options.length,
+ options == null ? 0 : options.length,
options,
enabled ? 1 : 0,
loop ? 1 : 0,
@@ -114,13 +117,13 @@ public class VLM
libvlc_exception_t exception = new libvlc_exception_t();
jvlc.getLibvlc().libvlc_vlm_play_media(jvlc.getInstance(), name, exception);
}
-
+
public void stopMedia(String name)
{
libvlc_exception_t exception = new libvlc_exception_t();
jvlc.getLibvlc().libvlc_vlm_stop_media(jvlc.getInstance(), name, exception);
}
-
+
public void pauseMedia(String name)
{
libvlc_exception_t exception = new libvlc_exception_t();
@@ -140,13 +143,29 @@ public class VLM
}
/**
- *
+ * Releases native resources related to VLM.
*/
public void release()
{
+ if (released)
+ {
+ return;
+ }
+ released = true;
libvlc_exception_t exception = new libvlc_exception_t();
jvlc.getLibvlc().libvlc_vlm_release(jvlc.getInstance(), exception);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void finalize() throws Throwable
+ {
+ release();
+ super.finalize();
+ }
+
+
}
More information about the vlc-devel
mailing list