Re: [Vala] Re : Release testing



fdsdœ Fsfsd schrieb:
[...]
Code:
Gtk.ListStore model = (Gtk..ListStore) combobox.get_model();
GLib.Value content_type = Value(typeof(string));;
model.get_value(iter, 2, ref content_type);
Message at runtime:
GLib-GObject-WARNING **: gvalue.c:185: cannot initialize GValue with
type `gchararray', the value has already been initialized as `gchararray'
[...]

Hello,

you should be able to hack around this problem by unsetting the Value
structure before passing it to the model method:

  // The type used here is irrelevant...
  GLib.Value content_type = Value(typeof(int));
  // ... because here we reset the structure to uninitialized state:
  content_type.unset();

  model.get_value(iter, 2, ref content_type);

However, since the Gtk+ library apparently insists on initializing the
Value structure in this situation, the signature of
Gtk.TreeModel.get_value should really include an out parameter, not a
ref parameter...

Also the GLib.Value.unset method should really have a special annotation
so that the compiler knows a Value structure is uninitialized after a
call to that method -- on the other hand this hack wouldn't work then ;-)

cu,
Thomas



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]