summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukefromdc <[email protected]>2018-07-09 18:59:25 -0400
committerlukefromdc <[email protected]>2018-07-12 15:44:31 -0400
commit881233e8e6b6f0d70fd6a2dcd4235afe94c9b659 (patch)
tree1f4e9d98667c33b2e8f10485b05ee5160efd8870
parent6f4843f6bcd5a23085f30ead1247afa1a7acbe6f (diff)
downloadmate-applets-881233e8e6b6f0d70fd6a2dcd4235afe94c9b659.tar.bz2
mate-applets-881233e8e6b6f0d70fd6a2dcd4235afe94c9b659.tar.xz
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
-rw-r--r--cpufreq/src/cpufreq-popup.c11
1 files changed, 10 insertions, 1 deletions
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);