Re: Why this code doesn't work?



I also have gtkmm 3.16.0 but pango version is 2.38.1

I also figured out there must some sort of forgotten reference count, after looking at stack trace layout destructor gets called twice (not sure), once by ~RefPtr::Layout and another time by Pango::Layout::~Layout

to make the code work I have done this, but I'm not sure how safe is this. but it works ^^ and no throw is made from Layout's destructor.

int main(int argc, char* argv[])
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create( argc, argv, "gtkmm.exe" );

class TestClass :
public Gtk::Window
{
public:
TestClass()
{
layout = (create_pango_layout("blah"));
layout->reference();
}

Glib::RefPtr<Pango::Layout> layout;
};

TestClass* instance = new TestClass;
app->run(*instance);
delete instance;
}


On Sat, Dec 19, 2015 at 8:54 PM, Phil Wolff <adiabat centurylink net> wrote:
No errors: Ubuntu,  g++ 5.2.1, gtkmm 3.16.0, pangomm 2.36.0

On 12/19/2015 11:37 AM, codekiddy wrote:


Simple example:

#include <pangomm/layout.h>
#include <gtkmm/window.h>

int main(int argc, char* argv[])
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create( argc, argv, "gtkmm.exe" );

class TestClass :
public Gtk::Window
{
public:
TestClass()
{
layout = (create_pango_layout("blah"));
}

Glib::RefPtr<Pango::Layout> layout;
};

TestClass instance;

return app->run(instance);
}

program builds and runs fine, but when closing the app down, it throws in Layout::~Layout() destructor. Access violation reading location.

Can you reproduce this?


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




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