spdk_top: fix app crashing on tab selection with TAB key

Fixes spdk_top crashing problem upon selecting a row in one tab,
then switching with TAB key to a different tab with fewer rows
and calling pop-up details window with ENTER key.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I52c5729eca0ce0eaad88767ff3add471a780140a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6367
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Krzysztof Karas 2021-02-04 10:30:00 +01:00 committed by Tomasz Zawadzki
parent 97ef870100
commit 6a34348219

View File

@ -2035,6 +2035,7 @@ show_thread(uint8_t current_page)
get_data();
assert(thread_number < g_threads_stats.threads.threads_count);
for (i = 0; i < g_threads_stats.threads.threads_count; i++) {
thread_info[i] = &g_threads_stats.threads.thread_info[i];
}
@ -2075,6 +2076,7 @@ show_core(uint8_t current_page)
get_data();
assert(core_number < g_cores_stats.cores.cores_count);
for (i = 0; i < g_cores_stats.cores.cores_count; i++) {
core_info[i] = &g_cores_stats.cores.core[i];
}
@ -2187,6 +2189,7 @@ show_poller(uint8_t current_page)
get_data();
prepare_poller_data(current_page, pollers, &count, current_page);
assert(poller_number < count);
poller_win = newwin(POLLER_WIN_HEIGHT, POLLER_WIN_WIDTH,
get_position_for_window(POLLER_WIN_HEIGHT, g_max_row),
@ -2309,6 +2312,7 @@ show_stats(void)
} else {
active_tab = THREADS_TAB;
}
g_selected_row = 0;
current_page = 0;
switch_tab(active_tab);
break;