Question

On running the following simple.cc example for gtkmm

#include <gtkmm.h>

int main(int argc, char * argv[]){
  Glib::RefPtr<Gtk::Application> app
    = Gtk::Application::create(argc,argv,"org.gtkmm..examples.base");
  Gtk::Window window;
  //Gtk::ApplicationWindow window(app);                                         
  return app->run(window);                                                  
}

I face the following message:

 (process:9428): GLib-GIO-CRITICAL **: g_application_set_application_id: assertion `application_id == NULL || g_application_id_is_valid (application_id)' failed

However, the application doesn't break, the window is produced and doesn't exit until I ctr+C the program.

What are the implications of this GLib-GIO-Critical message ? What do I do to suppress the message ?

Was it helpful?

Solution

If the provided application-id is not valid then it will not be set. I'm not familiar with the glibmm bits, but if you don't provide an ID to g_application_new then, according to the documentation, "...some features of GApplication (most notably application uniqueness) will be disabled."

"Suppressing" it is easy--just fix it. Provide a valid application ID or don't provide one at all (pass NULL instead of a string). In your example, getting rid of the extra dot ("org.gtkmm.examples.base" instead of "org.gtkmm..examples.base") should do the trick. The g_application_id_is_valid documentation explains what constitutes a valid ID, including that "Application identifiers must not contain consecutive '.' (period) characters."

OTHER TIPS

I'm glad with the explanation in the solution but .. based on that just pass an empty string "". However "org.gtkmm.example" should work

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top