From 881233e8e6b6f0d70fd6a2dcd4235afe94c9b659 Mon Sep 17 00:00:00 2001 From: lukefromdc Date: Mon, 9 Jul 2018 18:59:25 -0400 Subject: cpufreq: stop segfault with gtk3.23 Also stop any other segfaults caused by failure of deprecated gtk_action_group_get_action to return the name of the active item. With GTK 3.23.0 cpufreq_popup_menu_set_active sends invalid name information for userspace governors --- cpufreq/src/cpufreq-popup.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cpufreq/src/cpufreq-popup.c b/cpufreq/src/cpufreq-popup.c index faf0a480..049fe8b2 100644 --- a/cpufreq/src/cpufreq-popup.c +++ b/cpufreq/src/cpufreq-popup.c @@ -437,7 +437,16 @@ cpufreq_popup_menu_set_active_action (CPUFreqPopup *popup, g_snprintf (name, sizeof (name), "%s%s", prefix, item); action = gtk_action_group_get_action (action_group, name); - + + /* gtk_action_group_get_action can return NULL with frequencies (userspace governor) + * when the CPU does not actually stay locked to that exact frequency but rather to a + * frequency range. Since cpufreq_monitor_get_frequency gets the realtime frequency, this + * may not match any named frequency and then returns NULL. Return when this happens to + * avoid segfaults + */ + if (action == NULL) + return; + g_signal_handlers_block_by_func (action, cpufreq_popup_frequencies_menu_activate, popup); -- cgit v1.2.1