summaryrefslogtreecommitdiff
path: root/plugins/cdda
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-04-25 21:49:34 +0200
committerGravatar waker <wakeroid@gmail.com>2011-04-25 21:49:34 +0200
commit43a277e9d2dfaa2055184617495e1d3a48b8d9cc (patch)
tree6e98e5d4df0299825c6ec21ca51c37ca23ccf9d2 /plugins/cdda
parent3d8f7348c65f7b071ad488c6d09ecfa6e3baaee6 (diff)
new future-proof playlist API, potentially reducing locking, and allowing more flexibility
Diffstat (limited to 'plugins/cdda')
-rw-r--r--plugins/cdda/cdda.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c
index b8b0f84e..9df88719 100644
--- a/plugins/cdda/cdda.c
+++ b/plugins/cdda/cdda.c
@@ -395,7 +395,11 @@ cddb_thread (void *items_i)
}
cddb_disc_destroy (disc);
cleanup_thread_params (params);
- deadbeef->plt_modified (deadbeef->plt_get_handle (deadbeef->plt_get_curr ()));
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ if (plt) {
+ deadbeef->plt_modified (plt);
+ deadbeef->plt_unref (plt);
+ }
deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
}
@@ -584,10 +588,14 @@ cda_insert (DB_playItem_t *after, const char *fname) {
static int
cda_action_add_cd (DB_plugin_action_t *act, DB_playItem_t *it)
{
- deadbeef->pl_add_files_begin (deadbeef->plt_get_curr ());
- deadbeef->pl_add_file ("all.cda", NULL, NULL);
- deadbeef->pl_add_files_end ();
- deadbeef->plt_modified (deadbeef->plt_get_handle (deadbeef->plt_get_curr ()));
+ ddb_playlist_t *plt = deadbeef->plt_get_curr ();
+ if (plt) {
+ deadbeef->pl_add_files_begin (plt);
+ deadbeef->pl_add_file ("all.cda", NULL, NULL);
+ deadbeef->pl_add_files_end ();
+ deadbeef->plt_modified (plt);
+ deadbeef->plt_unref (plt);
+ }
deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
}