Branch: Tag:

2013-02-12

2013-02-12 17:46:17 by Henrik Grubbström (Grubba) <grubba@grubba.org>

GTK2: Fixed various issues in get_doc() et al.

* Changes API of pgtk2_get_doc(). The pushv parameter has been
replaced with a pointer to the desired svalue position.

* get_doc() did not take advantage of pgtk2_get_doc() supporting
pushing the result on the svalue stack.

* pgtk2_get_doc() returned an uninitialized pointer
when called with a non-zero pushv.

* pgtk2_get_doc() returned a g_new0()'ed svalue when called with
a zero pushv. This value was not freed later.

1443:    g_type_class_unref(class);   }    - struct svalue *pgtk2_get_doc(GObject *o, int pushv) { + void pgtk2_get_doc(GObject *o, struct svalue *dest) {    GType type=0;    GString *str; -  struct svalue *sv; +       /*    if (o)    type=G_OBJECT_TYPE(G_OBJECT(o)->obj);    else -  return NULL; +  return;   */    type=G_OBJECT_TYPE(o);    str=g_string_new_len(NULL,512);
1488:    }    push_string(make_shared_binary_string(str->str,str->len));    g_string_free(str,TRUE); -  if (!pushv) { -  sv=g_new0(struct svalue,1); -  assign_svalue_no_free(sv,&Pike_sp[-1]); +  if (dest) { +  assign_svalue_no_free(dest, Pike_sp - 1);    pop_stack(); -  return sv; +     } -  return sv; +    }