From 5e263d2ed0b408792963b4592c4f3c8c046e8e56 Mon Sep 17 00:00:00 2001 From: liquidaty Date: Wed, 18 Dec 2024 19:33:32 -0800 Subject: [PATCH] fix #345 --- app/sheet/read-data.c | 6 ++++-- app/sheet/transformation.c | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/sheet/read-data.c b/app/sheet/read-data.c index 7ca36a81..498e5d62 100644 --- a/app/sheet/read-data.c +++ b/app/sheet/read-data.c @@ -204,9 +204,12 @@ static int read_data(struct zsvsheet_ui_buffer **uibufferp, // a new zsvsheet_ if (!uibuff) return 0; + char need_index; pthread_mutex_lock(&uibuff->mutex); - char need_index = !uibuff->index_started && !uibuff->write_in_progress; + need_index = !uibuff->index_started; // && !uibuff->write_in_progress; char *old_ui_status = uibuff->status; + if (need_index) + uibuff->index_started = 1; pthread_mutex_unlock(&uibuff->mutex); if (need_index) { @@ -215,7 +218,6 @@ static int read_data(struct zsvsheet_ui_buffer **uibufferp, // a new zsvsheet_ uibuff->buff_used_rows = rows_read; uibuff->dimensions.row_count = rows_read; - uibuff->index_started = 1; if (original_row_num > 1 && rows_read > 0) { opts.stream = NULL; get_data_index_async(uibuff, filename, &opts, custom_prop_handler, old_ui_status); diff --git a/app/sheet/transformation.c b/app/sheet/transformation.c index 0b654ccd..ea1a682f 100644 --- a/app/sheet/transformation.c +++ b/app/sheet/transformation.c @@ -128,7 +128,7 @@ void *zsvsheet_transformation_user_context(zsvsheet_transformation trn) { return trn->user_context; } -static void *zsvsheet_run_buffer_transformation(void *arg) { +static void *zsvsheet_run_buffer_transformation(void *arg) { // REMOVE THIS ENTIRE FUNCTION??? struct zsvsheet_transformation *trn = arg; struct zsvsheet_ui_buffer *uib = trn->ui_buffer; zsv_parser parser = trn->parser; @@ -265,8 +265,7 @@ enum zsvsheet_status zsvsheet_push_transformation(zsvsheet_proc_context_t ctx, asprintf(&trn->default_status, "(working) Press ESC to cancel "); nbuff->status = trn->default_status; - - zsvsheet_ui_buffer_create_worker(nbuff, zsvsheet_run_buffer_transformation, trn); + // zsvsheet_ui_buffer_create_worker(nbuff, zsvsheet_run_buffer_transformation, trn); return stat; error: