summaryrefslogtreecommitdiff
path: root/plugins/vfs_curl
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-04 20:04:15 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-04 20:07:26 +0200
commit69f04b15c899d16b4f9ae3d9fe9ccb4f7da46ea4 (patch)
tree9aed999006dd52e62849ccdbfee20f497791b133 /plugins/vfs_curl
parent1bd73696a3c8484729460cad8d8e6a44e3649c16 (diff)
dependency-friendly unloading of plugins;
fixed crashes in artwork loader at shutdown
Diffstat (limited to 'plugins/vfs_curl')
-rw-r--r--plugins/vfs_curl/vfs_curl.c6
1 files changed, 6 insertions, 0 deletions
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;
}