Reputation: 2248
In my Python 2.7 + GTK+3 + PyGI + GUI made with Glade3 app I get a lot of errors like this:
(python.exe:81868): Gdk-CRITICAL **: gdk_device_get_source: assertion 'GDK_IS_DEVICE (device)' failed
There is no exception happening in Python and nothing is behaving wrong in the program. They seem to be harmless, but for cleanliness, I would like to stop them from happening.
I've noticed that this happens for example when activating and deactivating a menu item, or changing the selection on a combo box. I've tried to set a callback that does nothing on the events that trigger the problem, but no change.
So, what do they mean? How do I stop them?
Upvotes: 1
Views: 1133
Reputation: 1973
Such messages are emitted by code which use the Glib debugging functions, see [1], when an assertion fails. These assertions are used by Glib and many components built on Glib to report invalid states, invalid arguments, etc.
Often, such messages hint at errors in ones application, so it is a good idea to search for the cause. To do this, export the G_DEBUG
environment with the appropriate value, see [2]. In your case, you would set G_DEBUG=fatal-criticals
, and the program will abort when a critical message is emitted. If you then run your application in gdb
and print a backtrace when the program aborts, you should get an idea of what did lead to the message being emitted. Remember to install debuginfo packages for glib and gtk/gdk to obtain usable backtraces.
To disable the messages from being emitted, if you are not able to fix the issue (possibly because the cause is not your code, but i.e. some other library), you can look at g_log_set_handler
, see [3].
Upvotes: 2