Commit c15a5164 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Ignore exceptions correctly - don't let libvlc assert

parent ed2a403f
...@@ -115,8 +115,9 @@ int main( int i_argc, const char *ppsz_argv[] ) ...@@ -115,8 +115,9 @@ int main( int i_argc, const char *ppsz_argv[] )
if ((ppsz_argv[i] = FromLocale (ppsz_argv[i])) == NULL) if ((ppsz_argv[i] = FromLocale (ppsz_argv[i])) == NULL)
return 1; // BOOM! return 1; // BOOM!
libvlc_exception_t ex; libvlc_exception_t ex, dummy;
libvlc_exception_init (&ex); libvlc_exception_init (&ex);
libvlc_exception_init (&dummy);
/* Initialize libvlc */ /* Initialize libvlc */
int i_argc_real = i_argc ? i_argc - 1 : 0; int i_argc_real = i_argc ? i_argc - 1 : 0;
...@@ -125,9 +126,9 @@ int main( int i_argc, const char *ppsz_argv[] ) ...@@ -125,9 +126,9 @@ int main( int i_argc, const char *ppsz_argv[] )
if (vlc != NULL) if (vlc != NULL)
{ {
libvlc_add_intf (vlc, "signals", NULL); libvlc_add_intf (vlc, "signals", &dummy);
libvlc_add_intf (vlc, NULL, &ex); libvlc_add_intf (vlc, NULL, &ex);
libvlc_playlist_play (vlc, -1, 0, NULL, NULL); libvlc_playlist_play (vlc, -1, 0, NULL, &dummy);
libvlc_wait (vlc); libvlc_wait (vlc);
libvlc_release (vlc); libvlc_release (vlc);
} }
...@@ -136,6 +137,7 @@ int main( int i_argc, const char *ppsz_argv[] ) ...@@ -136,6 +137,7 @@ int main( int i_argc, const char *ppsz_argv[] )
fprintf( stderr, "%s\n", libvlc_exception_get_message( &ex)); fprintf( stderr, "%s\n", libvlc_exception_get_message( &ex));
libvlc_exception_clear (&ex); libvlc_exception_clear (&ex);
libvlc_exception_clear (&dummy);
for (int i = 0; i < i_argc; i++) for (int i = 0; i < i_argc; i++)
LocaleFree (ppsz_argv[i]); LocaleFree (ppsz_argv[i]);
......
...@@ -103,15 +103,16 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -103,15 +103,16 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
argc = parse_cmdline (psz_cmdline, &argv); argc = parse_cmdline (psz_cmdline, &argv);
libvlc_exception_t ex; libvlc_exception_t ex, dummy;
libvlc_exception_init (&ex); libvlc_exception_init (&ex);
libvlc_exception_init (&dummy);
/* Initialize libvlc */ /* Initialize libvlc */
libvlc_instance_t *vlc = libvlc_new (argc, (const char **)argv, &ex); libvlc_instance_t *vlc = libvlc_new (argc, (const char **)argv, &ex);
if (vlc != NULL) if (vlc != NULL)
{ {
libvlc_add_intf (vlc, NULL, &ex); libvlc_add_intf (vlc, NULL, &ex);
libvlc_playlist_play (vlc, -1, 0, NULL, NULL); libvlc_playlist_play (vlc, -1, 0, NULL, &dummy);
libvlc_wait (vlc); libvlc_wait (vlc);
libvlc_release (vlc); libvlc_release (vlc);
} }
...@@ -119,6 +120,7 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -119,6 +120,7 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
ret = libvlc_exception_raised (&ex); ret = libvlc_exception_raised (&ex);
libvlc_exception_clear (&ex); libvlc_exception_clear (&ex);
libvlc_exception_clear (&dummy);
return ret; return ret;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment