diff --git a/ChangeLog b/ChangeLog index fb67273318..37738b82af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-09-14 Jay Cox + + * app/pixel_processor.c: fix bug #24188. + * app/preferences_dialog.c: allow num_processors to be set on + the fly. + 2000-09-14 Michael Natterer * app/disp_callbacks.c: always position the menu inside the diff --git a/app/base/pixel-processor.c b/app/base/pixel-processor.c index 542c0a2369..d415d1091e 100644 --- a/app/base/pixel-processor.c +++ b/app/base/pixel-processor.c @@ -203,8 +203,7 @@ do_parallel_regions_single(PixelProcessor *p_s) static void pixel_regions_do_parallel(PixelProcessor *p_s) { - - IF_THREAD( + IF_THREAD( int nthreads; nthreads = MIN(num_processors, MAX_THREADS); @@ -227,7 +226,11 @@ pixel_regions_do_parallel(PixelProcessor *p_s) } for (i = 0; i < nthreads; i++) { - pthread_join(threads[i], NULL); + int ret; + if ((ret = pthread_join(threads[i], NULL))) + { + fprintf(stderr, "pixel_regions_do_parallel:: pthread_join returned: %d\n", ret); + } } if (p_s->nthreads != 0) fprintf(stderr, "pixel_regions_do_prarallel: we lost a thread\n"); @@ -247,7 +250,7 @@ pixel_regions_real_process_parallel(p_func f, void *data, PixelProcessor *p_s; - p_s = g_new(PixelProcessor, 200); + p_s = g_new(PixelProcessor, 1); for (i = 0; i < num_regions; i++) @@ -286,7 +289,8 @@ pixel_regions_real_process_parallel(p_func f, void *data, pixel_processor_free(p_s); return NULL; } - IF_THREAD(p_s->PRI->dirty_tiles = 0;) + /* Why would we wan't to set dirty_tiles to 0 here? */ + /* IF_THREAD(p_s->PRI->dirty_tiles = 0;) */ p_s->f = f; p_s->data = data; p_s->n_regions = num_regions; diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index d4a5cc6e3d..2ddf602653 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -138,7 +138,6 @@ static gint edit_min_colors; static gint edit_install_cmap; static gint edit_cycled_marching_ants; static gint edit_last_opened_size; -static gint edit_num_processors; static gint edit_show_indicators; static gint edit_nav_window_per_display; static gint edit_info_window_follows_mouse; @@ -170,7 +169,6 @@ static GtkWidget * prefs_dlg = NULL; install-cmap cycled-marching-ants last-opened-size - num-processors show-indicators nav-window-per-display info_window_follows_mouse @@ -303,10 +301,10 @@ file_prefs_check_settings (void) return PREFS_CORRUPT; } - if (edit_num_processors < 1 || edit_num_processors > 30) + if (num_processors < 1 || num_processors > 30) { g_message (_("Error: Number of processors must be between 1 and 30.")); - edit_num_processors = old_num_processors; + num_processors = old_num_processors; return PREFS_CORRUPT; } @@ -316,7 +314,6 @@ file_prefs_check_settings (void) edit_install_cmap != old_install_cmap || edit_cycled_marching_ants != old_cycled_marching_ants || edit_last_opened_size != old_last_opened_size || - edit_num_processors != old_num_processors || edit_show_indicators != old_show_indicators || edit_nav_window_per_display != old_nav_window_per_display || edit_info_window_follows_mouse != old_info_window_follows_mouse || @@ -448,7 +445,6 @@ file_prefs_save_callback (GtkWidget *widget, gint save_install_cmap; gint save_cycled_marching_ants; gint save_last_opened_size; - gint save_num_processors; gint save_show_indicators; gint save_nav_window_per_display; gint save_info_window_follows_mouse; @@ -498,7 +494,6 @@ file_prefs_save_callback (GtkWidget *widget, save_install_cmap = install_cmap; save_cycled_marching_ants = cycled_marching_ants; save_last_opened_size = last_opened_size; - save_num_processors = num_processors; save_show_indicators = show_indicators; save_nav_window_per_display = nav_window_per_display; save_info_window_follows_mouse = info_window_follows_mouse; @@ -684,6 +679,10 @@ file_prefs_save_callback (GtkWidget *widget, { update = g_list_append (update, "default-threshold"); } + if (num_processors != old_num_processors) + { + update = g_list_append (update, "num-processors"); + } /* values which can't be changed on the fly */ if (edit_stingy_memory_use != old_stingy_memory_use) @@ -711,11 +710,6 @@ file_prefs_save_callback (GtkWidget *widget, last_opened_size = edit_last_opened_size; update = g_list_append (update, "last-opened-size"); } - if (edit_num_processors != old_num_processors) - { - num_processors = edit_num_processors; - update = g_list_append (update, "num-processors"); - } if (edit_show_indicators != old_show_indicators) { show_indicators = edit_show_indicators; @@ -801,7 +795,6 @@ file_prefs_save_callback (GtkWidget *widget, install_cmap = save_install_cmap; cycled_marching_ants = save_cycled_marching_ants; last_opened_size = save_last_opened_size; - num_processors = save_num_processors; show_indicators = save_show_indicators; nav_window_per_display = save_nav_window_per_display; info_window_follows_mouse = save_info_window_follows_mouse; @@ -861,6 +854,7 @@ file_prefs_cancel_callback (GtkWidget *widget, help_browser = old_help_browser; cursor_mode = old_cursor_mode; default_threshold = old_default_threshold; + num_processors = old_num_processors; /* restore variables which need some magic */ if (preview_size != old_preview_size) @@ -897,7 +891,6 @@ file_prefs_cancel_callback (GtkWidget *widget, edit_install_cmap = old_install_cmap; edit_cycled_marching_ants = old_cycled_marching_ants; edit_last_opened_size = old_last_opened_size; - edit_num_processors = old_num_processors; edit_show_indicators = old_show_indicators; edit_nav_window_per_display = old_nav_window_per_display; edit_info_window_follows_mouse = old_info_window_follows_mouse; @@ -1363,7 +1356,6 @@ file_pref_cmd_callback (GtkWidget *widget, edit_install_cmap = install_cmap; edit_cycled_marching_ants = cycled_marching_ants; edit_last_opened_size = last_opened_size; - edit_num_processors = num_processors; edit_show_indicators = show_indicators; edit_nav_window_per_display = nav_window_per_display; edit_info_window_follows_mouse = info_window_follows_mouse; @@ -1422,6 +1414,7 @@ file_pref_cmd_callback (GtkWidget *widget, old_help_browser = help_browser; old_cursor_mode = cursor_mode; old_default_threshold = default_threshold; + old_num_processors = num_processors; file_prefs_strset (&old_image_title_format, image_title_format); file_prefs_strset (&old_default_comment, default_comment); @@ -1432,7 +1425,6 @@ file_pref_cmd_callback (GtkWidget *widget, old_install_cmap = edit_install_cmap; old_cycled_marching_ants = edit_cycled_marching_ants; old_last_opened_size = edit_last_opened_size; - old_num_processors = edit_num_processors; old_show_indicators = edit_show_indicators; old_nav_window_per_display = edit_nav_window_per_display; old_info_window_follows_mouse = edit_info_window_follows_mouse; @@ -2200,11 +2192,11 @@ file_pref_cmd_callback (GtkWidget *widget, #ifdef ENABLE_MP spinbutton = - gimp_spin_button_new (&adjustment, edit_num_processors, + gimp_spin_button_new (&adjustment, num_processors, 1, 30, 1.0, 2.0, 0.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &edit_num_processors); + &num_processors); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, _("Number of Processors to Use:"), 1.0, 0.5, spinbutton, 1, TRUE); diff --git a/app/gui/preferences-dialog.c b/app/gui/preferences-dialog.c index d4a5cc6e3d..2ddf602653 100644 --- a/app/gui/preferences-dialog.c +++ b/app/gui/preferences-dialog.c @@ -138,7 +138,6 @@ static gint edit_min_colors; static gint edit_install_cmap; static gint edit_cycled_marching_ants; static gint edit_last_opened_size; -static gint edit_num_processors; static gint edit_show_indicators; static gint edit_nav_window_per_display; static gint edit_info_window_follows_mouse; @@ -170,7 +169,6 @@ static GtkWidget * prefs_dlg = NULL; install-cmap cycled-marching-ants last-opened-size - num-processors show-indicators nav-window-per-display info_window_follows_mouse @@ -303,10 +301,10 @@ file_prefs_check_settings (void) return PREFS_CORRUPT; } - if (edit_num_processors < 1 || edit_num_processors > 30) + if (num_processors < 1 || num_processors > 30) { g_message (_("Error: Number of processors must be between 1 and 30.")); - edit_num_processors = old_num_processors; + num_processors = old_num_processors; return PREFS_CORRUPT; } @@ -316,7 +314,6 @@ file_prefs_check_settings (void) edit_install_cmap != old_install_cmap || edit_cycled_marching_ants != old_cycled_marching_ants || edit_last_opened_size != old_last_opened_size || - edit_num_processors != old_num_processors || edit_show_indicators != old_show_indicators || edit_nav_window_per_display != old_nav_window_per_display || edit_info_window_follows_mouse != old_info_window_follows_mouse || @@ -448,7 +445,6 @@ file_prefs_save_callback (GtkWidget *widget, gint save_install_cmap; gint save_cycled_marching_ants; gint save_last_opened_size; - gint save_num_processors; gint save_show_indicators; gint save_nav_window_per_display; gint save_info_window_follows_mouse; @@ -498,7 +494,6 @@ file_prefs_save_callback (GtkWidget *widget, save_install_cmap = install_cmap; save_cycled_marching_ants = cycled_marching_ants; save_last_opened_size = last_opened_size; - save_num_processors = num_processors; save_show_indicators = show_indicators; save_nav_window_per_display = nav_window_per_display; save_info_window_follows_mouse = info_window_follows_mouse; @@ -684,6 +679,10 @@ file_prefs_save_callback (GtkWidget *widget, { update = g_list_append (update, "default-threshold"); } + if (num_processors != old_num_processors) + { + update = g_list_append (update, "num-processors"); + } /* values which can't be changed on the fly */ if (edit_stingy_memory_use != old_stingy_memory_use) @@ -711,11 +710,6 @@ file_prefs_save_callback (GtkWidget *widget, last_opened_size = edit_last_opened_size; update = g_list_append (update, "last-opened-size"); } - if (edit_num_processors != old_num_processors) - { - num_processors = edit_num_processors; - update = g_list_append (update, "num-processors"); - } if (edit_show_indicators != old_show_indicators) { show_indicators = edit_show_indicators; @@ -801,7 +795,6 @@ file_prefs_save_callback (GtkWidget *widget, install_cmap = save_install_cmap; cycled_marching_ants = save_cycled_marching_ants; last_opened_size = save_last_opened_size; - num_processors = save_num_processors; show_indicators = save_show_indicators; nav_window_per_display = save_nav_window_per_display; info_window_follows_mouse = save_info_window_follows_mouse; @@ -861,6 +854,7 @@ file_prefs_cancel_callback (GtkWidget *widget, help_browser = old_help_browser; cursor_mode = old_cursor_mode; default_threshold = old_default_threshold; + num_processors = old_num_processors; /* restore variables which need some magic */ if (preview_size != old_preview_size) @@ -897,7 +891,6 @@ file_prefs_cancel_callback (GtkWidget *widget, edit_install_cmap = old_install_cmap; edit_cycled_marching_ants = old_cycled_marching_ants; edit_last_opened_size = old_last_opened_size; - edit_num_processors = old_num_processors; edit_show_indicators = old_show_indicators; edit_nav_window_per_display = old_nav_window_per_display; edit_info_window_follows_mouse = old_info_window_follows_mouse; @@ -1363,7 +1356,6 @@ file_pref_cmd_callback (GtkWidget *widget, edit_install_cmap = install_cmap; edit_cycled_marching_ants = cycled_marching_ants; edit_last_opened_size = last_opened_size; - edit_num_processors = num_processors; edit_show_indicators = show_indicators; edit_nav_window_per_display = nav_window_per_display; edit_info_window_follows_mouse = info_window_follows_mouse; @@ -1422,6 +1414,7 @@ file_pref_cmd_callback (GtkWidget *widget, old_help_browser = help_browser; old_cursor_mode = cursor_mode; old_default_threshold = default_threshold; + old_num_processors = num_processors; file_prefs_strset (&old_image_title_format, image_title_format); file_prefs_strset (&old_default_comment, default_comment); @@ -1432,7 +1425,6 @@ file_pref_cmd_callback (GtkWidget *widget, old_install_cmap = edit_install_cmap; old_cycled_marching_ants = edit_cycled_marching_ants; old_last_opened_size = edit_last_opened_size; - old_num_processors = edit_num_processors; old_show_indicators = edit_show_indicators; old_nav_window_per_display = edit_nav_window_per_display; old_info_window_follows_mouse = edit_info_window_follows_mouse; @@ -2200,11 +2192,11 @@ file_pref_cmd_callback (GtkWidget *widget, #ifdef ENABLE_MP spinbutton = - gimp_spin_button_new (&adjustment, edit_num_processors, + gimp_spin_button_new (&adjustment, num_processors, 1, 30, 1.0, 2.0, 0.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &edit_num_processors); + &num_processors); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, _("Number of Processors to Use:"), 1.0, 0.5, spinbutton, 1, TRUE); diff --git a/app/pixel_processor.c b/app/pixel_processor.c index 542c0a2369..d415d1091e 100644 --- a/app/pixel_processor.c +++ b/app/pixel_processor.c @@ -203,8 +203,7 @@ do_parallel_regions_single(PixelProcessor *p_s) static void pixel_regions_do_parallel(PixelProcessor *p_s) { - - IF_THREAD( + IF_THREAD( int nthreads; nthreads = MIN(num_processors, MAX_THREADS); @@ -227,7 +226,11 @@ pixel_regions_do_parallel(PixelProcessor *p_s) } for (i = 0; i < nthreads; i++) { - pthread_join(threads[i], NULL); + int ret; + if ((ret = pthread_join(threads[i], NULL))) + { + fprintf(stderr, "pixel_regions_do_parallel:: pthread_join returned: %d\n", ret); + } } if (p_s->nthreads != 0) fprintf(stderr, "pixel_regions_do_prarallel: we lost a thread\n"); @@ -247,7 +250,7 @@ pixel_regions_real_process_parallel(p_func f, void *data, PixelProcessor *p_s; - p_s = g_new(PixelProcessor, 200); + p_s = g_new(PixelProcessor, 1); for (i = 0; i < num_regions; i++) @@ -286,7 +289,8 @@ pixel_regions_real_process_parallel(p_func f, void *data, pixel_processor_free(p_s); return NULL; } - IF_THREAD(p_s->PRI->dirty_tiles = 0;) + /* Why would we wan't to set dirty_tiles to 0 here? */ + /* IF_THREAD(p_s->PRI->dirty_tiles = 0;) */ p_s->f = f; p_s->data = data; p_s->n_regions = num_regions; diff --git a/app/preferences_dialog.c b/app/preferences_dialog.c index d4a5cc6e3d..2ddf602653 100644 --- a/app/preferences_dialog.c +++ b/app/preferences_dialog.c @@ -138,7 +138,6 @@ static gint edit_min_colors; static gint edit_install_cmap; static gint edit_cycled_marching_ants; static gint edit_last_opened_size; -static gint edit_num_processors; static gint edit_show_indicators; static gint edit_nav_window_per_display; static gint edit_info_window_follows_mouse; @@ -170,7 +169,6 @@ static GtkWidget * prefs_dlg = NULL; install-cmap cycled-marching-ants last-opened-size - num-processors show-indicators nav-window-per-display info_window_follows_mouse @@ -303,10 +301,10 @@ file_prefs_check_settings (void) return PREFS_CORRUPT; } - if (edit_num_processors < 1 || edit_num_processors > 30) + if (num_processors < 1 || num_processors > 30) { g_message (_("Error: Number of processors must be between 1 and 30.")); - edit_num_processors = old_num_processors; + num_processors = old_num_processors; return PREFS_CORRUPT; } @@ -316,7 +314,6 @@ file_prefs_check_settings (void) edit_install_cmap != old_install_cmap || edit_cycled_marching_ants != old_cycled_marching_ants || edit_last_opened_size != old_last_opened_size || - edit_num_processors != old_num_processors || edit_show_indicators != old_show_indicators || edit_nav_window_per_display != old_nav_window_per_display || edit_info_window_follows_mouse != old_info_window_follows_mouse || @@ -448,7 +445,6 @@ file_prefs_save_callback (GtkWidget *widget, gint save_install_cmap; gint save_cycled_marching_ants; gint save_last_opened_size; - gint save_num_processors; gint save_show_indicators; gint save_nav_window_per_display; gint save_info_window_follows_mouse; @@ -498,7 +494,6 @@ file_prefs_save_callback (GtkWidget *widget, save_install_cmap = install_cmap; save_cycled_marching_ants = cycled_marching_ants; save_last_opened_size = last_opened_size; - save_num_processors = num_processors; save_show_indicators = show_indicators; save_nav_window_per_display = nav_window_per_display; save_info_window_follows_mouse = info_window_follows_mouse; @@ -684,6 +679,10 @@ file_prefs_save_callback (GtkWidget *widget, { update = g_list_append (update, "default-threshold"); } + if (num_processors != old_num_processors) + { + update = g_list_append (update, "num-processors"); + } /* values which can't be changed on the fly */ if (edit_stingy_memory_use != old_stingy_memory_use) @@ -711,11 +710,6 @@ file_prefs_save_callback (GtkWidget *widget, last_opened_size = edit_last_opened_size; update = g_list_append (update, "last-opened-size"); } - if (edit_num_processors != old_num_processors) - { - num_processors = edit_num_processors; - update = g_list_append (update, "num-processors"); - } if (edit_show_indicators != old_show_indicators) { show_indicators = edit_show_indicators; @@ -801,7 +795,6 @@ file_prefs_save_callback (GtkWidget *widget, install_cmap = save_install_cmap; cycled_marching_ants = save_cycled_marching_ants; last_opened_size = save_last_opened_size; - num_processors = save_num_processors; show_indicators = save_show_indicators; nav_window_per_display = save_nav_window_per_display; info_window_follows_mouse = save_info_window_follows_mouse; @@ -861,6 +854,7 @@ file_prefs_cancel_callback (GtkWidget *widget, help_browser = old_help_browser; cursor_mode = old_cursor_mode; default_threshold = old_default_threshold; + num_processors = old_num_processors; /* restore variables which need some magic */ if (preview_size != old_preview_size) @@ -897,7 +891,6 @@ file_prefs_cancel_callback (GtkWidget *widget, edit_install_cmap = old_install_cmap; edit_cycled_marching_ants = old_cycled_marching_ants; edit_last_opened_size = old_last_opened_size; - edit_num_processors = old_num_processors; edit_show_indicators = old_show_indicators; edit_nav_window_per_display = old_nav_window_per_display; edit_info_window_follows_mouse = old_info_window_follows_mouse; @@ -1363,7 +1356,6 @@ file_pref_cmd_callback (GtkWidget *widget, edit_install_cmap = install_cmap; edit_cycled_marching_ants = cycled_marching_ants; edit_last_opened_size = last_opened_size; - edit_num_processors = num_processors; edit_show_indicators = show_indicators; edit_nav_window_per_display = nav_window_per_display; edit_info_window_follows_mouse = info_window_follows_mouse; @@ -1422,6 +1414,7 @@ file_pref_cmd_callback (GtkWidget *widget, old_help_browser = help_browser; old_cursor_mode = cursor_mode; old_default_threshold = default_threshold; + old_num_processors = num_processors; file_prefs_strset (&old_image_title_format, image_title_format); file_prefs_strset (&old_default_comment, default_comment); @@ -1432,7 +1425,6 @@ file_pref_cmd_callback (GtkWidget *widget, old_install_cmap = edit_install_cmap; old_cycled_marching_ants = edit_cycled_marching_ants; old_last_opened_size = edit_last_opened_size; - old_num_processors = edit_num_processors; old_show_indicators = edit_show_indicators; old_nav_window_per_display = edit_nav_window_per_display; old_info_window_follows_mouse = edit_info_window_follows_mouse; @@ -2200,11 +2192,11 @@ file_pref_cmd_callback (GtkWidget *widget, #ifdef ENABLE_MP spinbutton = - gimp_spin_button_new (&adjustment, edit_num_processors, + gimp_spin_button_new (&adjustment, num_processors, 1, 30, 1.0, 2.0, 0.0, 1.0, 0.0); gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", GTK_SIGNAL_FUNC (gimp_int_adjustment_update), - &edit_num_processors); + &num_processors); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, _("Number of Processors to Use:"), 1.0, 0.5, spinbutton, 1, TRUE);