Discussion:
Segfault!
Paul van der Walt
2010-12-19 16:33:20 UTC
Permalink
Hi,

Encountered something strange today; when using the file browser
view, and pressing `e' on a directory to recursively enqueue it,
cmus segfaults. I enabled debug, and I think this was the
problem:

ip_open: opening `/blabla/Gentle Giant/1975 - Free Hand/Cover Art/booklet-1.jpg' failed: -2.

Shouldn't jpeg's etc be skipped? I'm using the version one gets
when simply doing `git clone'.

Cheers!

Paul
--
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
Johannes Weißl
2010-12-19 16:58:51 UTC
Permalink
Hi Paul,
Post by Paul van der Walt
Encountered something strange today; when using the file browser
view, and pressing `e' on a directory to recursively enqueue it,
cmus segfaults. I enabled debug, and I think this was the
ip_open: opening `/blabla/Gentle Giant/1975 - Free Hand/Cover Art/booklet-1.jpg' failed: -2.
Shouldn't jpeg's etc be skipped? I'm using the version one gets
when simply doing `git clone'.
There seems to be a segfault caused by my rbtree patch when adding
tracks to the queue (under certain circumstances). I'm trying to figure
it out right now!


Johannes
Johannes Weißl
2010-12-19 18:07:12 UTC
Permalink
This sequence of actions caused a segfault:
1. start to play from library
2. add two random songs to queue
3. play next song (which is from queue)
4. start to play the song from 1. from library
5. add any song to queue

Reason:
The play_queue.c module was using the editable.c functions
inconsistently (sometimes through editable_add, sometimes directly
modifying the internal linked list). This caused the internal rbtree to
degenerate.
---
play_queue.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/play_queue.c b/play_queue.c
index cd0c5c4..2f78eef 100644
--- a/play_queue.c
+++ b/play_queue.c
@@ -26,7 +26,11 @@ void play_queue_append(struct track_info *ti)
{
struct simple_track *t = simple_track_new(ti);

- editable_add(&pq_editable, t);
+ list_add_tail(&t->node, &pq_editable.head);
+ pq_editable.nr_tracks++;
+ if (t->info->duration != -1)
+ pq_editable.total_time += t->info->duration;
+ window_changed(pq_editable.win);
}

void play_queue_prepend(struct track_info *ti)
--
1.7.2.3
Paul van der Walt
2010-12-19 20:06:06 UTC
Permalink
Post by Johannes Weißl
1. start to play from library
2. add two random songs to queue
3. play next song (which is from queue)
4. start to play the song from 1. from library
5. add any song to queue
I tried these steps before and after the patch, and it does seem
to solve the problem. Thanks!

Paul
--
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
Gregory Petrosyan
2010-12-20 08:38:56 UTC
Permalink
Post by Johannes Weißl
1. start to play from library
2. add two random songs to queue
3. play next song (which is from queue)
4. start to play the song from 1. from library
5. add any song to queue
The play_queue.c module was using the editable.c functions
inconsistently (sometimes through editable_add, sometimes directly
modifying the internal linked list). This caused the internal rbtree to
degenerate.
Thanks a lot for the quick fix Johannes and thanks for the reporing Paul!

I've pushed the patch to -master.

P.S. Spent almost an hour trying to figure out what the patch does,
with -maint checked out! Stupid me.

                Gregory

Johannes Weißl
2010-12-19 18:13:10 UTC
Permalink
Post by Johannes Weißl
There seems to be a segfault caused by my rbtree patch when adding
tracks to the queue (under certain circumstances). I'm trying to figure
it out right now!
Actually, the bug was in the play_queue.c module, it just did not cause
any harm before the rbtree patch. Did it solve your problem?


Johannes
Loading...