From 99ed049721302715d4c689114d63d37cff655f02 Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Tue, 22 Nov 2016 22:21:17 +0100 Subject: fix first seq counter index and mem overflow. --- VERSION | 2 +- sherlock_nk.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 2685240..677f38c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.2727 +0.11.2729 diff --git a/sherlock_nk.c b/sherlock_nk.c index 65233b5..d82c357 100644 --- a/sherlock_nk.c +++ b/sherlock_nk.c @@ -224,7 +224,7 @@ _clear(plughandle_t *handle) _clear_items(handle); nk_str_clear(&handle->str); handle->selected = NULL; - handle->counter = 0; + handle->counter = 1; } void @@ -430,14 +430,16 @@ port_event(LV2UI_Handle instance, uint32_t i, uint32_t size, uint32_t urid, } case 2: { - if(handle->state.block) + const bool overflow = handle->n_item > MAX_LINES; + + if(overflow && handle->state.overwrite) { - break; + _clear(handle); } - if( (handle->n_item > MAX_LINES) && handle->state.overwrite) + if(overflow || handle->state.block) { - _clear(handle); + break; } const LV2_Atom *atom = buf; -- cgit v1.2.1