I am using gtk 4.6.2
I am seeing some critical and warning messages with the following code.
#include <glib/gi18n.h>
#include <gtk/gtk.h>
GtkWidget *window = NULL;
static void dialog_response( GtkDialog *dialog, int response, gpointer user_data )
{
switch( response )
{
case GTK_RESPONSE_YES:
fprintf( stderr, "%s %d GTK_RESPONSE_YES\n", __func__, __LINE__ );
gtk_window_destroy( GTK_WINDOW( window ) );
break;
case GTK_RESPONSE_NO:
fprintf( stderr, "%s %d GTK_RESPONSE_NO\n", __func__, __LINE__ );
gtk_window_destroy( GTK_WINDOW( dialog ) );
break;
}
}
static void close_req_handler()
{
GtkWidget *dialog = gtk_dialog_new_with_buttons( "Alert", GTK_WINDOW( window ), GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
"Yes", GTK_RESPONSE_YES,
"No", GTK_RESPONSE_NO,
NULL
);
if( g_signal_connect( dialog, "response", G_CALLBACK(dialog_response), NULL ) <= 0 )
{
fprintf( stderr, "Unable to connect\n" );
exit(1);
}
gtk_widget_show( dialog );
}
static void activate( GtkApplication *app, gpointer user_data )
{
window = gtk_application_window_new( app );
if( g_signal_connect( window, "close_request", G_CALLBACK(close_req_handler), NULL ) <= 0 )
{
fprintf( stderr, "Unable to connect\n" );
exit(1);
}
gtk_widget_show( window );
}
int main( int argc, char **argv )
{
GtkApplication *app = gtk_application_new ("my.own.application", G_APPLICATION_FLAGS_NONE);
if( g_signal_connect( app, "activate", G_CALLBACK( activate ), NULL ) <= 0 )
{
fprintf( stderr, "Unable to connect\n" );
exit(1);
}
int status = g_application_run( G_APPLICATION( app ), argc, argv);
g_object_unref( app );
return status;
}
I am seeing the following messages:
$ gcc dialog.c `pkg-config --cflags --libs gtk4` && ./a.out
Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed
dialog_response 15 GTK_RESPONSE_NO
Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed
Unsupported modifier, resource creation failed.
XXX: resource creation failed
dialog_response 15 GTK_RESPONSE_NO
dialog_response 11 GTK_RESPONSE_YES
(a.out:16045): GLib-GObject-WARNING **: 20:06:37.603: instance with invalid (NULL) class pointer
(a.out:16045): GLib-GObject-CRITICAL **: 20:06:37.603: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(a.out:16045): GLib-GObject-WARNING **: 20:06:37.603: instance with invalid (NULL) class pointer
(a.out:16045): GLib-GObject-CRITICAL **: 20:06:37.603: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(a.out:16045): GLib-GObject-WARNING **: 20:06:37.603: instance with invalid (NULL) class pointer
(a.out:16045): GLib-GObject-CRITICAL **: 20:06:37.603: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(a.out:16045): GLib-GObject-WARNING **: 20:06:37.603: instance with invalid (NULL) class pointer
(a.out:16045): GLib-GObject-CRITICAL **: 20:06:37.603: g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Unable to understand why those messages are showing up. Is there a way to get rid of them ?