st: Use g_signal_handler_disconnect() to disconnect from StTheme
With a high enough amount of actors, there may be enough theme nodes and signal connections on StTheme::custom-stylesheets-changed that g_signal_handlers_disconnect_by*() on dispose becomes expensive, this may become a surprisingly hot spot in StWidget::style-changed. Keep the handler ID around and use g_signal_handler_disconnect() to avoid linear lookups for the matching func/data. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/524
This commit is contained in:
parent
d57234bec9
commit
fb04dafb0b
@ -107,6 +107,8 @@ struct _StThemeNode {
|
||||
int box_shadow_min_width;
|
||||
int box_shadow_min_height;
|
||||
|
||||
guint stylesheets_changed_id;
|
||||
|
||||
CoglPipeline *border_slices_texture;
|
||||
CoglPipeline *border_slices_pipeline;
|
||||
CoglPipeline *background_texture;
|
||||
|
@ -111,9 +111,11 @@ st_theme_node_dispose (GObject *gobject)
|
||||
node->icon_colors = NULL;
|
||||
}
|
||||
|
||||
if (node->theme)
|
||||
g_signal_handlers_disconnect_by_func (node->theme,
|
||||
on_custom_stylesheets_changed, node);
|
||||
if (node->theme && node->stylesheets_changed_id)
|
||||
{
|
||||
g_signal_handler_disconnect (node->theme, node->stylesheets_changed_id);
|
||||
node->stylesheets_changed_id = 0;
|
||||
}
|
||||
|
||||
st_theme_node_paint_state_free (&node->cached_state);
|
||||
|
||||
@ -230,8 +232,9 @@ st_theme_node_new (StThemeContext *context,
|
||||
if (theme != NULL)
|
||||
{
|
||||
node->theme = g_object_ref (theme);
|
||||
g_signal_connect (node->theme, "custom-stylesheets-changed",
|
||||
G_CALLBACK (on_custom_stylesheets_changed), node);
|
||||
node->stylesheets_changed_id =
|
||||
g_signal_connect (node->theme, "custom-stylesheets-changed",
|
||||
G_CALLBACK (on_custom_stylesheets_changed), node);
|
||||
}
|
||||
|
||||
node->element_type = element_type;
|
||||
|
Loading…
Reference in New Issue
Block a user