Re: How to use Pango::Context?

2022-02-22 Thread Kjell Ahlstedt via gtkmm-list
No, there is no bug report. I have fixed it at 
gitlab.gnome.org/GNOME/pangomm, branches pangomm-2-46, pangomm-2-48 and 
master.


It looks like this bug has existed for at least 14 years. Hasn't anyone 
used Pango::Context::get_font_map() before?


Den 2022-02-21 kl. 20:28, skrev phosit--- via gtkmm-list:

Thank you for the answer and the fix.
Is ther a bug report i can track?___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: How to use Pango::Context?

2022-02-21 Thread phosit--- via gtkmm-list
Thank you for the answer and the fix.
Is ther a bug report i can track?
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: How to use Pango::Context?

2022-02-21 Thread Kjell Ahlstedt via gtkmm-list
It's a bug in Pango::Context::get_font_map(). It should get its own 
reference to the font map, but it doesn't. Until the bug has been fixed 
in pangomm, you can add a reference yourself.


auto fontMap = context->get_font_map();
fontMap->reference();  // Temporary bug fix

Note that when you start using a fixed version of pangomm, the call to 
fontMap->reference() will cause a memory leak.


Den 2022-02-21 kl. 16:12, skrev phosit--- via gtkmm-list:

does the error occur if you do windows.reserve(2) before the
emplace_back()s?

Yes
__
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: How to use Pango::Context?

2022-02-21 Thread phosit--- via gtkmm-list
> does the error occur if you do windows.reserve(2) before the
> emplace_back()s?

Yes
___
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


Re: How to use Pango::Context?

2022-02-21 Thread Daniel Boles via gtkmm-list
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, 
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 
> #includs thee 
> #include 
>
> 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 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