Skip to content

Commit

Permalink
Fix two bugs -- patch release pqiv 2.8.1
Browse files Browse the repository at this point in the history
* Fix support for duplicate files in sorted mode
* Fix MagickWand exit handler code

The second bug could lead to a crash, though a fairly harmless one
generated by a deliberate abort() call: If the MagickWand atexit()
handler was called from another but the main thread, it could happen
that MagickWand functions were used after the terminus call.
  • Loading branch information
phillipberndt committed Feb 26, 2017
1 parent c603edb commit ba838d2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
4 changes: 4 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ Known bugs
Changelog
---------

pqiv 2.8.1
* Fix support for duplicate files in sorted mode
* Fix MagickWand exit handler code

pqiv 2.8
* Added option --allow-empty-window: Show pqiv even if no images can be loaded
* Explicitly allow to load all files from a directory multiple times
Expand Down
1 change: 0 additions & 1 deletion lib/bostree.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ BOSNode *bostree_insert(BOSTree *tree, void *key, void *data) {
node = &(*node)->left_child_node;
}
else {
assert(cmp > 0);
(*node)->right_child_count++;
node = &(*node)->right_child_node;
}
Expand Down
43 changes: 25 additions & 18 deletions pqiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -5010,7 +5010,7 @@ gboolean initialize_gui_or_quit_callback(gpointer user_data) {/*{{{*/

if(!file_tree_valid || bostree_node_count(file_tree) == 0) {
g_printerr("No images left to display.\n");
exit(1);
gtk_main_quit();
}

return FALSE;
Expand Down Expand Up @@ -5584,7 +5584,8 @@ gpointer load_images_thread(gpointer user_data) {/*{{{*/
if(!option_wait_for_images_to_appear) {
if(tree_empty) {
g_printerr("No images left to display.\n");
exit(1);
g_idle_add((GSourceFunc)gtk_main_quit, NULL);
return NULL;
}

if(option_lazy_load) {
Expand All @@ -5599,7 +5600,26 @@ gpointer load_images_thread(gpointer user_data) {/*{{{*/
#endif
return NULL;
}/*}}}*/
gboolean inner_main(void *user_data) {/*{{{*/
if(option_lazy_load) {
if(option_allow_empty_window) {
create_window();
gtk_widget_show_all(GTK_WIDGET(main_window));
main_window_visible = TRUE;
}

g_thread_new("image-loader", load_images_thread, GINT_TO_POINTER(1));
}
else {
load_images_thread(NULL);
if(!initialize_gui()) {
g_printerr("No images left to display.\n");
gtk_main_quit();
}
}

return FALSE;
}/*}}}*/
int main(int argc, char *argv[]) {
#ifdef DEBUG
#ifndef _WIN32
Expand Down Expand Up @@ -5669,22 +5689,9 @@ int main(int argc, char *argv[]) {
}
#endif

if(option_lazy_load) {
if(option_allow_empty_window) {
create_window();
gtk_widget_show_all(GTK_WIDGET(main_window));
main_window_visible = TRUE;
}

g_thread_new("image-loader", load_images_thread, GINT_TO_POINTER(1));
}
else {
load_images_thread(NULL);
if(!initialize_gui()) {
g_printerr("No images left to display.\n");
exit(1);
}
}
// Start image loader & show window inside main loop, in order to have
// gtk_main_quit() available.
gdk_threads_add_idle(inner_main, NULL);

gtk_main();

Expand Down
2 changes: 1 addition & 1 deletion pqiv.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "lib/bostree.h"

#ifndef PQIV_VERSION
#define PQIV_VERSION "2.8"
#define PQIV_VERSION "2.8.1"
#endif

#define FILE_FLAGS_ANIMATION (guint)(1)
Expand Down

0 comments on commit ba838d2

Please sign in to comment.