From: Max Kellermann Date: Mon, 14 Jul 2014 08:40:18 +0000 (+0200) Subject: screen_browser: fix crash on "jump" (hotkey ".") X-Git-Tag: v0.24~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e7c6e5fe86fb1660a291eecce441c936f2877f53;p=ncmpc.git screen_browser: fix crash on "jump" (hotkey ".") Regression caused by commit 4345c919f: screen_browser_paint_callback() now expects a struct screen_browser pointer instead of a struct filelist pointer, because it now requires access to the song format. However, browser_lw_callback() still wants a struct filelist, and the CMD_LIST_JUMP handler passes the former to screen_jump() for both callbacks. --- diff --git a/NEWS b/NEWS index a0798cd..187b72c 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ ncmpc 0.24 - not yet released +* fix crash on "jump" (hotkey ".") ncmpc 0.23 - (2014-07-10) diff --git a/src/screen_artist.c b/src/screen_artist.c index 3ffc931..01b29be 100644 --- a/src/screen_artist.c +++ b/src/screen_artist.c @@ -717,13 +717,15 @@ screen_artist_cmd(struct mpdclient *c, command_t cmd) case CMD_LIST_JUMP: switch (mode) { case LIST_ARTISTS: - screen_jump(browser.lw, screen_artist_lw_callback, + screen_jump(browser.lw, + screen_artist_lw_callback, artist_list, paint_artist_callback, artist_list); artist_repaint(); return true; case LIST_ALBUMS: - screen_jump(browser.lw, screen_artist_lw_callback, + screen_jump(browser.lw, + screen_artist_lw_callback, album_list, paint_album_callback, album_list); artist_repaint(); return true; diff --git a/src/screen_browser.c b/src/screen_browser.c index ff209db..30fb726 100644 --- a/src/screen_browser.c +++ b/src/screen_browser.c @@ -403,8 +403,9 @@ browser_cmd(struct screen_browser *browser, browser->filelist); return true; case CMD_LIST_JUMP: - screen_jump(browser->lw, browser_lw_callback, - screen_browser_paint_callback, browser->filelist); + screen_jump(browser->lw, + browser_lw_callback, browser->filelist, + screen_browser_paint_callback, browser); return true; #ifdef HAVE_GETMOUSE diff --git a/src/screen_find.c b/src/screen_find.c index 88872df..f131af7 100644 --- a/src/screen_find.c +++ b/src/screen_find.c @@ -93,9 +93,8 @@ screen_find(struct list_window *lw, command_t findcmd, * which begins with this string while the users types */ void screen_jump(struct list_window *lw, - list_window_callback_fn_t callback_fn, - list_window_paint_callback_t paint_callback, - void *callback_data) + list_window_callback_fn_t callback_fn, void *callback_data, + list_window_paint_callback_t paint_callback, void *paint_data) { const int WRLN_MAX_LINE_SIZE = 1024; int key = 65; @@ -134,7 +133,7 @@ screen_jump(struct list_window *lw, /* repaint the list_window */ if (paint_callback != NULL) - list_window_paint2(lw, paint_callback, callback_data); + list_window_paint2(lw, paint_callback, paint_data); else list_window_paint(lw, callback_fn, callback_data); wrefresh(lw->w); diff --git a/src/screen_find.h b/src/screen_find.h index 76a2ffd..85a97dd 100644 --- a/src/screen_find.h +++ b/src/screen_find.h @@ -42,8 +42,7 @@ screen_find(struct list_window *lw, * which begins with this string while the users types */ void screen_jump(struct list_window *lw, - list_window_callback_fn_t callback_fn, - list_window_paint_callback_t paint_callback, - void *callback_data); + list_window_callback_fn_t callback_fn, void *callback_data, + list_window_paint_callback_t paint_callback, void *paint_data); #endif diff --git a/src/screen_queue.c b/src/screen_queue.c index 7fd73aa..7c1041c 100644 --- a/src/screen_queue.c +++ b/src/screen_queue.c @@ -644,7 +644,7 @@ screen_queue_cmd(struct mpdclient *c, command_t cmd) screen_queue_repaint(); return true; case CMD_LIST_JUMP: - screen_jump(lw, screen_queue_lw_callback, NULL, NULL); + screen_jump(lw, screen_queue_lw_callback, NULL, NULL, NULL); screen_queue_save_selection(); screen_queue_repaint(); return true;