#179 rbgtktreestore reorder

closed-fixed
nobody
None
7
2012-08-26
2012-08-25
Anonymous
No

Hi,

I think there is a problem with this function because there is no need to know how many columns there are to sort iters, no ?

rbgtktreestore.c :

static VALUE
rg_reorder(VALUE self, VALUE rbparent, VALUE rbnew_order)
{
GtkTreeStore *store = _SELF(self);
GtkTreeIter *parent = RVAL2GTKTREEITER(rbparent);
gint columns = gtk_tree_model_get_n_columns(GTK_TREE_MODEL(store));
long n;
gint *new_order = RVAL2GINTS(rbnew_order, n);

if (n != columns) {
g_free(new_order);

rb_raise(rb_eArgError,
"new order array must contain same number of elements as the number of columns in the store: %ld != %d",
n, columns);
}

gtk_tree_store_reorder(store, parent, new_order);

g_free(new_order);

return self;
}

Discussion


  • Anonymous
    2012-08-25

    • priority: 5 --> 7
     
  • Kouhei Sutou
    Kouhei Sutou
    2012-08-26

    Thanks for your report!
    I've fixed it in master.

    It should be checked against the number of children instead of the number of columns.

     
  • Kouhei Sutou
    Kouhei Sutou
    2012-08-26

    • status: open --> closed-fixed