# HG changeset patch # User Calin Crisan ccrisan@gmail.com # Date 1185570521 -10800 # Node ID e2754a023ae0c38cbdbbe05d8285a57b17b37232 # Parent eb6c11de9f339f9cee51de6bc4afb10bc8017ea2 Fixed surprise eject segfault diff -r eb6c11de9f33 -r e2754a023ae0 src/cdaudio-ng/cdaudio-ng.c --- a/src/cdaudio-ng/cdaudio-ng.c Fri Jul 27 23:03:20 2007 +0300 +++ b/src/cdaudio-ng/cdaudio-ng.c Sat Jul 28 00:08:41 2007 +0300 @@ -19,7 +19,6 @@ #include #include #include -//#include // todo: this should be available soon (by 1.4) #include #include #include "config.h" @@ -203,7 +202,8 @@ if (cdio_get_media_changed(pcdio) && pcdio != NULL) { if (debug) printf("cdaudio-ng: cd changed, rescanning\n"); - cdaudio_scan_dir(CDDA_DEFAULT); + if (cdaudio_scan_dir(CDDA_DEFAULT) == NULL) + pcdio = NULL; } if (pcdio == NULL) { @@ -269,7 +269,8 @@ cleanup_on_error(); return NULL; } - cdio_free_device_list(ppcd_drives); + if (ppcd_drives != NULL && *ppcd_drives != NULL) + cdio_free_device_list(ppcd_drives); } /* limit read speed */ @@ -463,6 +464,13 @@ cdaudio_scan_dir(CDDA_DEFAULT); } + if (trackinfo == NULL) { + if (debug) + printf("cdaudio-ng: no cd information can be retrieved, aborting\n"); + pinputplayback->playing = FALSE; + return; + } + int trackno = find_trackno_from_filename(pinputplayback->filename); if (trackno < firsttrackno || trackno > lasttrackno) { fprintf(stderr, "cdaudio-ng: trackno %d is out of range [%d..%d]\n", trackno, firsttrackno, lasttrackno); @@ -737,6 +745,9 @@ TitleInput *create_tuple_from_trackinfo(char *filename) { + if (trackinfo == NULL) + return NULL; + TitleInput *tuple = bmp_title_input_new(); int trackno = find_trackno_from_filename(filename); @@ -869,7 +880,6 @@ { if (playing_track != -1) { playing_track = -1; - playback_stop(); } if (trackinfo != NULL) {