From 3c6c9741ffafdc7ae02abe87f656a4f760fb9600 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 21 Apr 2019 22:24:24 +0200 Subject: [PATCH] Fix vlc crash --- src/engine/vlcengine.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/engine/vlcengine.cpp b/src/engine/vlcengine.cpp index b53d2e646..193921305 100644 --- a/src/engine/vlcengine.cpp +++ b/src/engine/vlcengine.cpp @@ -50,7 +50,9 @@ VLCEngine::VLCEngine(TaskManager *task_manager) VLCEngine::~VLCEngine() { - libvlc_media_player_stop(player_); + if (state_ == Engine::Playing || state_ == Engine::Paused) { + libvlc_media_player_stop(player_); + } libvlc_media_player_release(player_); libvlc_release(instance_); @@ -58,16 +60,8 @@ VLCEngine::~VLCEngine() { bool VLCEngine::Init() { - const char *args[] = { - //"--verbose=3", - "--ignore-config", - "--no-plugins-cache", - "--no-xlib", - "--no-video", - }; - // Create the VLC instance - instance_ = libvlc_new(sizeof(args) / sizeof(*args), args); + instance_ = libvlc_new(0, nullptr); if (!instance_) return false; // Create the media player