1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-22 20:14:04 +02:00

eeshow/gui/history.c (click_history): jumped to wrong sheet on sel_new + swap

In this case, both (!) old and new changed:
old old -> new new
selected -> new old

This caused eeshow to lose sheet navigation.

Reported by Joerg Reisenweber.
This commit is contained in:
Werner Almesberger 2016-08-19 15:30:42 -03:00
parent 35bc584767
commit 3307eb5b05

View File

@ -105,7 +105,7 @@ static void click_history(void *user)
{ {
struct gui_hist *h = user; struct gui_hist *h = user;
struct gui_ctx *ctx = h->ctx; struct gui_ctx *ctx = h->ctx;
struct gui_sheet *sheet; struct gui_sheet *sheet, *old_sheet;
hide_history(ctx); hide_history(ctx);
@ -114,6 +114,9 @@ static void click_history(void *user)
sheet = find_corresponding_sheet(h->sheets, sheet = find_corresponding_sheet(h->sheets,
ctx->new_hist->sheets, ctx->curr_sheet); ctx->new_hist->sheets, ctx->curr_sheet);
old_sheet = find_corresponding_sheet(
ctx->old_hist ? ctx->old_hist->sheets : ctx->new_hist->sheets,
ctx->new_hist->sheets, ctx->curr_sheet);
switch (ctx->selecting) { switch (ctx->selecting) {
case sel_only: case sel_only:
@ -134,10 +137,12 @@ static void click_history(void *user)
if (ctx->new_hist->age > ctx->old_hist->age) { if (ctx->new_hist->age > ctx->old_hist->age) {
swap(ctx->new_hist, ctx->old_hist); swap(ctx->new_hist, ctx->old_hist);
if (ctx->selecting == sel_old) if (ctx->selecting == sel_old) {
go_to_sheet(ctx, sheet); go_to_sheet(ctx, sheet);
else } else {
go_to_sheet(ctx, old_sheet);
render_delta(ctx); render_delta(ctx);
}
} else { } else {
if (ctx->selecting != sel_old) if (ctx->selecting != sel_old)
go_to_sheet(ctx, sheet); go_to_sheet(ctx, sheet);