Re: Gio::Action lookup crash



The following modification produces the expected result:

#include <gtkmm.h>
#include <iostream>

class App: public Gtk::ApplicationWindow
{
    public:
        App()
        {
            add_action("int");
        }
    virtual void on_realize ();
};

void App::on_realize ()
{
    Gtk::ApplicationWindow::on_realize ();
    auto la = lookup_action("int");
    std::cout << bool(la) << std::endl;
}

int main(int argc, char *argv[])
{
    auto app = Gtk::Application::create(argc, argv, "test.gtk");
    App win;
    return app->run(win);
}

On 2016/04/27 03:52, Yann LEYDIER wrote:
Hi,

I have this simple program :

#include <gtkmm.h>
#include <iostream>

class App: public Gtk::ApplicationWindow
{
    public:
        App()
        {
            add_action("int");
            auto la = lookup_action("int");
            std::cout << bool(la) << std::endl;
        }
};

int main(int argc, char *argv[])
{
    auto app = Gtk::Application::create(argc, argv, "test.gtk");
    App win;
    return app->run(win);
}

The expected output is "1", but instead I get twice this message: "GLib-Object-CRITICAL **: g_object_get_qdata: assertion 'G_IS_OBJECT (object)' failed" and then the application crashes.


If I add the action to a Gio::SimpleActionGroup instead, it works.

I tested with Gtkmm 3.10 on Linux and 3.18 on Windows.

What am I doing wrong?

Thanks,
yann
_______________________________________________
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]