diff options
-rw-r--r-- | plugins.c | 15 | ||||
-rw-r--r-- | plugins/artwork/albumartorg.c | 1 | ||||
-rw-r--r-- | plugins/artwork/artwork.c | 7 | ||||
-rw-r--r-- | plugins/artwork/lastfm.c | 1 | ||||
-rw-r--r-- | plugins/vfs_curl/vfs_curl.c | 6 |
5 files changed, 22 insertions, 8 deletions
@@ -722,13 +722,18 @@ plug_load_all (void) { void plug_unload_all (void) { + fprintf (stderr, "plug_unload_all\n"); + plugin_t *p; + for (p = plugins; p; p = p->next) { + if (p->plugin->stop) { + fprintf (stderr, "stopping %s...\n", p->plugin->name); + fflush (stderr); + p->plugin->stop (); + } + } + fprintf (stderr, "stopped all plugins\n"); while (plugins) { plugin_t *next = plugins->next; - if (plugins->plugin->stop) { - fprintf (stderr, "stopping %s...", plugins->plugin->name); - plugins->plugin->stop (); - fprintf (stderr, " [OK]\n"); - } if (plugins->handle) { dlclose (plugins->handle); } diff --git a/plugins/artwork/albumartorg.c b/plugins/artwork/albumartorg.c index 74e58d6d..cc10f235 100644 --- a/plugins/artwork/albumartorg.c +++ b/plugins/artwork/albumartorg.c @@ -44,6 +44,7 @@ fetch_from_albumart_org (const char *artist, const char *album, const char *dest } const char searchstr[] = "http://ecx.images-amazon.com/images/I/"; char buffer[10000]; + memset (buffer, 0, sizeof (buffer)); char *img = NULL; int size = deadbeef->fread (buffer, 1, sizeof (buffer), fp); if (size > 0) { diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c index 284a4754..ef0c9113 100644 --- a/plugins/artwork/artwork.c +++ b/plugins/artwork/artwork.c @@ -11,15 +11,15 @@ #include "albumartorg.h" #define min(x,y) ((x)<(y)?(x):(y)) -#define trace(...) { fprintf(stderr, __VA_ARGS__); } -//#define trace(...) + +//#define trace(...) { fprintf(stderr, __VA_ARGS__); } +#define trace(...) #define DEFAULT_COVER_PATH (PREFIX "/share/deadbeef/pixmaps/noartwork.jpg") static DB_artwork_plugin_t plugin; DB_functions_t *deadbeef; - typedef struct cover_query_s { char *fname; char *artist; @@ -535,6 +535,7 @@ static int artwork_plugin_stop (void) { if (tid) { + printf ("terminate artwork plugin\n"); terminate = 1; deadbeef->cond_signal (cond); deadbeef->thread_join (tid); diff --git a/plugins/artwork/lastfm.c b/plugins/artwork/lastfm.c index df08c2b9..6f429bf7 100644 --- a/plugins/artwork/lastfm.c +++ b/plugins/artwork/lastfm.c @@ -32,6 +32,7 @@ fetch_from_lastfm (const char *artist, const char *album, const char *dest) const char searchstr[] = "<image size=\"extralarge\">"; char buffer[1000]; + memset (buffer, 0, sizeof (buffer)); char *img = NULL; int size = deadbeef->fread (buffer, 1, sizeof (buffer), fp); if (size > 0) { diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c index 517d55ce..c376b2ed 100644 --- a/plugins/vfs_curl/vfs_curl.c +++ b/plugins/vfs_curl/vfs_curl.c @@ -76,6 +76,7 @@ static char http_err[CURL_ERROR_SIZE]; static int vfs_curl_abort; static int vfs_curl_count; +static int allow_new_streams; static size_t http_content_header_handler (void *ptr, size_t size, size_t nmemb, void *stream); @@ -518,6 +519,9 @@ http_start_streamer (HTTP_FILE *fp) { static DB_FILE * http_open (const char *fname) { + if (!allow_new_streams) { + return NULL; + } trace ("http_open\n"); HTTP_FILE *fp = malloc (sizeof (HTTP_FILE)); memset (fp, 0, sizeof (HTTP_FILE)); @@ -805,12 +809,14 @@ vfs_curl_on_abort (DB_event_t *ev, uintptr_t data) { static int vfs_curl_start (void) { deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_ABORTREAD, DB_CALLBACK (vfs_curl_on_abort), 0); + allow_new_streams = 1; return 0; } static int vfs_curl_stop (void) { deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_ABORTREAD, DB_CALLBACK (vfs_curl_on_abort), 0); + allow_new_streams = 0; vfs_curl_on_abort (NULL, 0); return 0; } |