fix SIGSEGV when choosing Sounds from Actions menu

Review Request #793 — Created July 8, 2021 and submitted

Information

libgnt/libgnt
release-2.x.y
416ae98e01ca

Reviewers

fix SIGSEGV when choosing Sounds from Actions menu in Finch

Opened Sounds window in Finch.
There's another location in Finch where 'gnt_combo_box_get_dropdown' is called, which I would've liked to test, but I couldn't reach it. It's 'update_selected_account' in gntrequest.c which is triggered by some signal. The signal connection is established when username and accountlist fields are requested in 'finch_request_fields', but I didn't find a window in Finch where that's done (which doesn't mean it doesn't exist, just that I'm too unfamiliar with Finch to know where to look).

Description From Last Updated

PS, while this should be fixed, I do wonder what is calling this with a GntBox instead of a GntComboBox, …

QuLogicQuLogic
QuLogic
  1. Ship It!
  2. 
      
QuLogic
  1. 
      
  2. Show all issues

    PS, while this should be fixed, I do wonder what is calling this with a GntBox instead of a GntComboBox, and how that can be fixed.

    1. The only other place I found where gnt_combo_box_get_dropdown is used also passes a GntComboBox.

      static void
      update_selected_account(GntEntry *username, const char *start, const char *end,
              GntComboBox *accountlist)
      {
          GList *accounts =
              gnt_tree_get_rows(GNT_TREE(gnt_combo_box_get_dropdown(accountlist)));
      

      These two were added by changeset 39649. I don't think this was ever supposed to be a GntBox (since a GntBox doesn't have a dropdown member).

      diff --git a/finch/gntrequest.c b/finch/gntrequest.c
      --- a/finch/gntrequest.c
      +++ b/finch/gntrequest.c
      @@ -410,7 +410,8 @@ static void
       update_selected_account(GntEntry *username, const char *start, const char *end,
                      GntComboBox *accountlist)
       {
      -       GList *accounts = gnt_tree_get_rows(GNT_TREE(accountlist->dropdown));
      +       GList *accounts =
      +               gnt_tree_get_rows(GNT_TREE(gnt_combo_box_get_dropdown(accountlist)));
              const char *name = gnt_entry_get_text(username);
              while (accounts) {
                      if (purple_find_buddy(accounts->data, name)) {
      diff --git a/finch/gntsound.c b/finch/gntsound.c
      --- a/finch/gntsound.c
      +++ b/finch/gntsound.c
      @@ -974,7 +974,8 @@ finch_sounds_show_all(void)
              gnt_box_set_pad(GNT_BOX(box), 0);
      
              pref_dialog->method = cmbox = gnt_combo_box_new();
      -       gnt_tree_set_hash_fns(GNT_TREE(GNT_COMBO_BOX(cmbox)->dropdown), g_str_hash, g_str_equal, NULL);
      +       gnt_tree_set_hash_fns(GNT_TREE(gnt_combo_box_get_dropdown(GNT_COMBO_BOX(cmbox))),
      +                       g_str_hash, g_str_equal, NULL);
              gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "automatic", _("Automatic"));
              gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "alsa", "ALSA");
              gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "esd", "ESD");
      
    2. This was just a typo that was missed in review and apparently we never triggered the error..

      https://keep.imfreedom.org/libgnt/libgnt/rev/abe8010bbae0

  3. 
      
grim
  1. Ship It!
  2. 
      
grim
Review request changed
Status:
Completed