I use the newest GTK+ installed with MSYS2 and whenever I attempt to use
g_application_send_notification()
it always results in the following
assert:
(Notification Project.exe:27780): GLib-GObject-CRITICAL **: g_object_new:
assertion 'G_TYPE_IS_OBJECT (object_type)' failed
Why I think it is a bug - because I tried many code samples beside mines (they are all quite like mines anyway), of people who got it working (including notifaction by Lars Uebernickel) and it all makes the same lament. Assert, followed by crash. Now I really don't know what this means, as it is probably within gtk internals, but I really hope some of you might have a clue or experience with this.
- install (GNU coreutils) 8.25
- GIO version 2.52.3
- mingw32/mingw-w64-i686-gtk-engine-unico 1.0.2-2 [installed]
- mingw32/mingw-w64-i686-gtk3 3.22.16-1 [installed]
- mingw32/mingw-w64-i686-gtkmm3 3.22.0-1 [installed]
- mingw32/mingw-w64-i686-spice-gtk 0.33-1 [installed]
- mingw32/mingw-w64-i686-webkitgtk3 2.4.11-4 [installed]
- mingw64/mingw-w64-x86_64-gtk-engine-unico 1.0.2-2 [installed]
- mingw64/mingw-w64-x86_64-gtk3 3.22.16-1 [installed]
- mingw64/mingw-w64-x86_64-gtkmm3 3.22.0-1 [installed]
- mingw64/mingw-w64-x86_64-spice-gtk 0.33-1 [installed]
- mingw64/mingw-w64-x86_64-webkitgtk3 2.4.11-4 [installed]
An example of code that generates this assert:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gtk/gtk.h>
#define ICON_PATH "/path/trash_16x16.gif"
int main (int argc, char *argv[])
{
GApplication *app;
app = g_application_new ("org.one", G_APPLICATION_FLAGS_NONE);
if(!app)
{
g_print ("Error app\n");
}
else
{
if(g_application_register (app, NULL, NULL))
{
GNotification *notification;
GFile *file;
GIcon *icon;
notification = g_notification_new ("one");
g_notification_set_body (notification, "Hello world");
file = g_file_new_for_path (ICON_PATH);
icon = g_file_icon_new (file);
g_notification_set_icon (notification, G_ICON (icon));
g_application_send_notification (app, NULL, notification);
g_object_unref (icon);
g_object_unref (file);
g_object_unref (notification);
g_object_unref (app);
g_print ("yes\n");
}
else
{
g_print ("no\n");
}
}
return 0;
}
Is that anything I can do to bypass this problem, or perhaps even solve it?