Skip to content

Commit 881233e

Browse files
committed
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
1 parent 6f4843f commit 881233e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎cpufreq/src/cpufreq-popup.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,16 @@ cpufreq_popup_menu_set_active_action (CPUFreqPopup *popup,
437437

438438
g_snprintf (name, sizeof (name), "%s%s", prefix, item);
439439
action = gtk_action_group_get_action (action_group, name);
440-
440+
441+
/* gtk_action_group_get_action can return NULL with frequencies (userspace governor)
442+
* when the CPU does not actually stay locked to that exact frequency but rather to a
443+
* frequency range. Since cpufreq_monitor_get_frequency gets the realtime frequency, this
444+
* may not match any named frequency and then returns NULL. Return when this happens to
445+
* avoid segfaults
446+
*/
447+
if (action == NULL)
448+
return;
449+
441450
g_signal_handlers_block_by_func (action,
442451
cpufreq_popup_frequencies_menu_activate,
443452
popup);

0 commit comments

Comments
 (0)