Code

screen_browser: fix crash on "jump" (hotkey ".")
authorMax Kellermann <max@duempel.org>
Mon, 14 Jul 2014 08:40:18 +0000 (10:40 +0200)
committerMax Kellermann <max@duempel.org>
Mon, 14 Jul 2014 08:41:50 +0000 (10:41 +0200)
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.

NEWS
src/screen_artist.c
src/screen_browser.c
src/screen_find.c
src/screen_find.h
src/screen_queue.c

diff --git a/NEWS b/NEWS
index a0798cd5db707beb311fd58e4d2e847ac2978861..187b72cee70d5d9f982fdc62c01c8249e665acfc 100644 (file)
--- 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)
index 3ffc931137719459e8c9f4fe75031ce18993f5ff..01b29be7d24d0fa1c0b9f42ff677bb1fea153e50 100644 (file)
@@ -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;
index ff209db2bfb46146dca776b051235053a2349304..30fb726133650a05c6ad4d1b354a466c5da8a720 100644 (file)
@@ -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
index 88872df5097e0e3ea38073b0f2a4a02bb4a90152..f131af72d482e0d52114c1b5c34b26b02f4839e8 100644 (file)
@@ -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);
index 76a2ffdc289c25355e72de03e7d34233618825ab..85a97dd3b7bb2352ac0c131a8c9b4cbb95528db8 100644 (file)
@@ -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
index 7fd73aa7080c2e1531507b0debe3a2d86217d11e..7c1041cadfe28268e5210b95c97c09c4a4c6c031 100644 (file)
@@ -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;