init() is a method in Glib::ValueBase, base class
of all Glib::Value<> specializations. The documentation
says On 2019-03-05 14:37,
Pavlo Solntsev via gtkmm-list wrote:
Thanks, that works. Out of curiosity, why not to call init() in the constructor? On Tue, 2019-03-05 at 11:00 +0100, Kjell Ahlstedt wrote:Replace data.init(G_TYPE_DATE_TIME); by data.init(data.value_type()); or data.init(Glib::Value<Glib::DateTime>::value_type()); You don't store a GDateTime, you store a Glib::DateTime. That's not the same thing. This is not well described in the documentation, but there is an example at https://gitlab.gnome.org/GNOME/glibmm/blob/master/tests/glibmm_value/main.cc On 2019-03-04 14:05, Pavlo Solntsev via gtkmm-list wrote:Hi, Have this code ``` Glib::Value<int> datai; datai.init(G_TYPE_INT); datai.set(8); std::cout << "Value = " << datai.get() << std::endl; ``` I see in stdout: Value = 8 Works good. Now I would like to use another type: Glib::DateTime ``` Glib::Value<Glib::DateTime> data; data.init(G_TYPE_DATE_TIME); Glib::DateTime ctime = Glib::DateTime::create_now_utc(); data.set(ctime); ``` This compiles ok, but generates Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7b2405c in Glib::DateTime::operator= (this=0x0, src="" at_______________________________________________ gtkmm-list mailing list gtkmm-list gnome org https://mail.gnome.org/mailman/listinfo/gtkmm-list/home/pavlo/jhbuild/checkout/glibmm-2.4/glib/glibmm/datetime.cc:89 89 if(gobject_) |