does the error occur if you do windows.reserve(2) before the emplace_back()s?
On Mon, 21 Feb 2022, 14:30 phosit--- via gtkmm-list, <gtkmm-list@gnome.org> wrote: > Hello > I try to list the awailable font-families. > If I open and close multiple windows ther is a critical error: > GLib-GObject-CRITICAL **: 15:22:32.722: g_object_unref: assertion > 'G_IS_OBJECT (object)' failed > > This is the code, the error ocours even without the uncomented code: > > #include <gtkmm/application.h> > #includs thee <gtkmm/window.h> > #include <gtkmm/textview.h> > > class Window: public Gtk::Window > { > public: > Window() > { > this->show(); > this->set_child(this->text); > > auto context = this->text.create_pango_context(); > auto fontMap = context->get_font_map(); > // auto fontList = fontMap->list_families(); > // auto buffer = this->text.get_buffer(); > // auto iter = buffer->get_iter_at_offset(0); > // for(const auto& fam : fontList) > // { > // iter = buffer->insert(iter, > // fam->get_name() + '\n'); > // } > // } > > private: > Gtk::TextView text; > }; > > auto main() -> int > { > std::vector<Window> windows; > auto app = Gtk::Application::create(); > > app->signal_activate().connect([&] > { > auto& w0 = windows.emplace_back(); > app->add_window(w0); > auto& w1 = windows.emplace_back(); > app->add_window(w1); > }); > > return app->run(); > } > _______________________________________________ > gtkmm-list mailing list > gtkmm-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtkmm-list >
_______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list