deliberate crashes in Gnome libraries ?

I have a general question about why some Gnome libraries include code which deliberately crashes the app if it does something the library considers iincorrect instead of letting the app blunder on. Examples :-

gtk+ : gtkcontainer.c line 988
 gtk_container_remove (GtkContainer *container,
		      GtkWidget    *widget)
  g_return_if_fail (GTK_IS_CONTAINER (container));
  g_return_if_fail (GTK_IS_WIDGET (widget));

  /* When using the deprecated API of the toolbar, it is possible
   * to legitimately call this function with a widget that is not
   * a direct child of the container.
  g_return_if_fail (GTK_IS_TOOLBAR (container) ||
		    widget->parent == GTK_WIDGET (container));
This crashes boinc client gui, app works fine if this is removed.

Glib : gthread-impl.c line 296
g_thread_init (GThreadFunctions* init)
  gboolean supported;

  if (thread_system_already_initialized)
    g_error ("GThread system may only be initialized once.");
This crashes sweep, which works oK if test is removed.

I found a similar assert in libxcb which crashed boincclient-gui and other apps until I removed it. So why are these apparently hostile lines of code there ? Shouldn't apps be allowed to do whatever they like ?

------------------------------------------------------------------------------------------------- - find out how to make your pc work for the community

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]