Re: deliberate crashes in Gnome libraries ?



hi Rod,

it does not crash the application, it displays a message and aborts. You can
disable these checks during build and this can be debated wheter distribution
should do it or not. The developer should have them definitely active. The
purpose is that the library figures out that something is wrong as soon as
possible. If in the example below you call a function that works on container
widgets and give it a GtkCellRenderer that it should stop immediately. This
gives you the change to get a menaingful backtrace in gdb. If it continues, the
user will wonder why the UI look borked and nobody fixes the bug.

Stefan

Rod Butcher wrote:
> 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 ?
> 
> Thanks
> Rod




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