From f84f6a42f8122bae9fbb2aa63fe8673979eb68ca Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Mon, 8 Mar 2010 21:49:41 +0100 Subject: [PATCH] Updated search function Incremental search is disabled now by default --- config.def.h | 4 ++-- zathura.c | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h index c1b257d..255453b 100644 --- a/config.def.h +++ b/config.def.h @@ -129,8 +129,8 @@ BufferCommand buffer_commands[] = { /* special commands */ SpecialCommand special_commands[] = { /* identifier, function, a, argument */ - {'/', scmd_search, 1, { DOWN } }, - {'?', scmd_search, 1, { UP } }, + {'/', scmd_search, 0, { DOWN } }, + {'?', scmd_search, 0, { UP } }, }; /* settings */ diff --git a/zathura.c b/zathura.c index 9d89025..d3337e7 100644 --- a/zathura.c +++ b/zathura.c @@ -1076,9 +1076,13 @@ search(void* parameter) pthread_mutex_lock(&(Zathura.Lock.document_lock)); PopplerPage* page = poppler_document_get_page(Zathura.PDF.document, next_page); pthread_mutex_unlock(&(Zathura.Lock.document_lock)); + if(!page) pthread_exit(NULL); + + pthread_mutex_lock(&(Zathura.PDF.pages[next_page]->lock)); results = poppler_page_find_text(page, search_item); + pthread_mutex_unlock(&(Zathura.PDF.pages[next_page]->lock)); if(results) break; @@ -2867,9 +2871,7 @@ int main(int argc, char* argv[]) arg.n = ADJUST_OPEN; sc_adjust_window(&arg); - if(!g_thread_supported()) - g_thread_init(NULL); - gdk_threads_init(); + g_thread_init(NULL); gtk_main(); return 0;