Skip to content

Commit

Permalink
Merge pull request geany#3902 from techee/progressbar_cpu
Browse files Browse the repository at this point in the history
Fix elevated CPU usage after ui_progress_bar_start/stop() is used
  • Loading branch information
b4n committed Jun 14, 2024
2 parents b7f3e32 + 0cf6930 commit 9483873
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/printing.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ static void end_print(GtkPrintOperation *operation, GtkPrintContext *context, gp
if (dinfo == NULL)
return;

/* see ui_progress_bar_stop() for more details on why this is called */
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(main_widgets.progressbar), 0.0);
gtk_widget_hide(main_widgets.progressbar);
g_object_unref(dinfo->sci);
g_object_unref(dinfo->layout);
Expand Down
4 changes: 4 additions & 0 deletions src/ui_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2863,6 +2863,10 @@ void ui_progress_bar_stop(void)
g_source_remove(progress_bar_timer_id);
progress_bar_timer_id = 0;
}

/* hack to remove tick callback which is created for "activity mode" progress
* bars - without this it is called forever and causes elevated CPU usage */
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(main_widgets.progressbar), 0.0);
}


Expand Down

0 comments on commit 9483873

Please sign in to comment.