Skip to content
  • Matthijs Velsink's avatar
    shortcutmanager: Track propagation phase of added controllers · aadaf4ad
    Matthijs Velsink authored
    GtkShortcutManager allows adding controllers to it. For the default
    implementation, they get added to one of two models, based on the
    propagation phase (either GTK_PHASE_CAPTURE or GTK_PHASE_BUBBLE).
    
    However, when a controller is removed, its presence in the manager gets
    checked against the current propagation phase of the controller, which
    may have changed from when it was added. This can lead to crashes if the
    controller was not disposed properly since it still has a reference in
    one of the two models of the GtkShortcutManager.
    
    To fix this, add a callback for `notify::propagation-phase`, which
    removes the controller from all possible models and readds it again with
    its current phase. This callback is only disconnected permanently when
    the controller is manually removed with
    `gtk_shortcut_manager_default_remove_controller()`.
    
    Closes #6246
    aadaf4ad