Debugging tips

Fixing GLib/GTK+ critical errors

Sometimes it can be difficult to track down where GLib critical errors are occurring, since they do not stop the program. You can set the program to stop as soon as it gets a GLib critical error, by setting the environment variable G_DEBUG to the value fatal_criticals.

  1. Open the Run Parameters Dialog by selecting Run ▸ Program Parameters... from the main menu.

  2. Click the plus sign next to Environment Variables to expand the list of environment variables.

  3. Click New to add a new entry to the list.

  4. Fill in Name with G_DEBUG and Value with fatal_criticals.

  5. Click Apply to confirm the changes.

  6. Run the program with the debugger by selecting Run ▸ Debug Program from the main menu.

  7. Use the program until the critical error occurs.

  8. When the debugger stops your program, look at the Stack to check where this error comes from.

The top function with frame number 0 is in GLib, so you have to look down in the stack. Typically the error originates from the topmost function that belongs to your program.