Mercurial > audlegacy
comparison src/audacious/playlist.c @ 3636:65b750891387
Possibly fix a lockup problem.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 25 Sep 2007 23:09:09 +0300 |
parents | b20e98407a30 |
children | 8d2f06fc841c |
comparison
equal
deleted
inserted
replaced
3635:b20e98407a30 | 3636:65b750891387 |
---|---|
668 InputPlugin * dec) | 668 InputPlugin * dec) |
669 { | 669 { |
670 PlaylistEntry *entry; | 670 PlaylistEntry *entry; |
671 Tuple *main_tuple = NULL; | 671 Tuple *main_tuple = NULL; |
672 gint nsubtunes = 0, i = 0; | 672 gint nsubtunes = 0, i = 0; |
673 gboolean add_flag = TRUE; | |
673 | 674 |
674 g_return_if_fail(playlist != NULL); | 675 g_return_if_fail(playlist != NULL); |
675 g_return_if_fail(filename != NULL); | 676 g_return_if_fail(filename != NULL); |
676 | 677 |
677 if (tuple != NULL) { | 678 if (tuple != NULL) { |
680 main_tuple = tuple; | 681 main_tuple = tuple; |
681 i = 1; | 682 i = 1; |
682 } | 683 } |
683 } | 684 } |
684 | 685 |
685 for (; i <= nsubtunes; i++) { | 686 for (; add_flag && i <= nsubtunes; i++) { |
686 gchar *filename_entry; | 687 gchar *filename_entry; |
687 | 688 |
688 if (nsubtunes > 0) { | 689 if (nsubtunes > 0) { |
689 filename_entry = g_strdup_printf("%s?%d", filename, main_tuple->subtunes[i]); | 690 filename_entry = g_strdup_printf("%s?%d", filename, main_tuple->subtunes[i]); |
690 /* We're dealing with subtune, let's ask again tuple information | 691 /* We're dealing with subtune, let's ask again tuple information |
699 entry = playlist_entry_new(filename_entry, | 700 entry = playlist_entry_new(filename_entry, |
700 tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL, | 701 tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL, |
701 tuple ? tuple_get_int(tuple, FIELD_LENGTH, NULL) : -1, dec); | 702 tuple ? tuple_get_int(tuple, FIELD_LENGTH, NULL) : -1, dec); |
702 g_free(filename_entry); | 703 g_free(filename_entry); |
703 | 704 |
704 if(!playlist->tail) | 705 if (!playlist->tail) |
705 playlist->tail = g_list_last(playlist->entries); | 706 playlist->tail = g_list_last(playlist->entries); |
706 | 707 |
707 PLAYLIST_LOCK(playlist); | 708 PLAYLIST_LOCK(playlist); |
708 | 709 |
709 if ((pos == -1) && (i < 2)) { // the common case | 710 if ((pos == -1) && (i < 2)) { // the common case |
715 | 716 |
716 if(!playlist->entries) { // this is the first element | 717 if(!playlist->entries) { // this is the first element |
717 playlist->entries = element; | 718 playlist->entries = element; |
718 playlist->tail = element; | 719 playlist->tail = element; |
719 } else { // the rests | 720 } else { // the rests |
720 g_return_if_fail(playlist->tail != NULL); | 721 if (playlist->tail != NULL) { |
721 playlist->tail->next = element; | 722 playlist->tail->next = element; |
722 playlist->tail = element; | 723 playlist->tail = element; |
724 } else | |
725 add_flag = FALSE; | |
723 } | 726 } |
724 } else { | 727 } else { |
725 playlist->entries = g_list_insert(playlist->entries, entry, pos); | 728 playlist->entries = g_list_insert(playlist->entries, entry, pos); |
726 } | 729 } |
727 | 730 |