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;