Re: Some wxpython questions about gtk wxPython Unicode 2.8.1.1



Hi,

Almost all public gtk+ functions use g_return_if_fail -family of macros
to validate preconditions when an API function is called. This could
look like the following:

gpointer foo(gpointer a)
{
  g_return_val_if_fail(a != NULL, NULL);

  ... Do some real stuff here
}

So, this checks that the programmer has not made a mistake and calls the
function with invalid parameters (This is not meant to be input
validation, but a logic validation).

If this function is then called with an "invalid" value, like

  a = NULL;
  b = foo(a);

This causes something like this to appear into console:

  CRITICAL **: foo: assertion `a != NULL' failed

And function returns NULL. This doesn't crash your program, though.

The crash may take place if the application doesn't take into account
that the function can return NULL (for example). In our previous case,
the following would crash:

  a = NULL;
  b = foo(a);
  *b = ....;

This causes NULL-pointer reference, which leads to segfault.

To put it short, if you see the criticals about failed assertions, your
program is suffering a bug at program logic somewhere. It may be that
the problem is somewhere int the Python bindings of gtk.

-Markku-

On Tue, 2007-02-06 at 10:21 +0100, Franz Steinhaeusler wrote:
> Hello List/Group,
> 
> Sorry for crossposting, but I think the chances are higher to get an answer.
> 
> I also already asked in other forums/groups, but here are the experts,
> and I want to get so much information as possible. :)
> 
> 
> Problem is:
> 
> I have wxPython 2.8.1.1 Unicode on Ubuntu (6.10) Linux, and the same program
> runs flawlessly on Windows, but not on Linux
> 
> 
>   1) If a "Segmentation fault (core dumped)" happend, it is a crash, isn't it?
>   
>       So after that assertions, a segmentation fault follows.
>         
>       ** (python:12488): CRITICAL **: gail_menu_item_ref_child: assertion `(i >= 0)' failed
>          Segmentation fault (core dumped)
> 
>       ** (python:12542): CRITICAL **: gail_menu_item_ref_child: assertion `(i >= 0)' failed
>          Segmentation fault (core dumped)
> 
>       
>       a) How can I trace back, what a segmentation fault caused?
>       
>       b) What does that mean (gail_menu_item_ref_child: assertion `(i >= 0)' failed)?
>       
>       c) What is the best way to debug or isolate this to a certatin piece of code this?
> 
> 	2) (python:4848): Gtk-CRITICAL **: gtk_window_realize_icon: assertion `info->icon_pixmap == NULL' failed
>      What does that mean?
> 
>   3) After startup, the message: "GTK Accessibility Module initialized" appears. 
>       Is this message necessary?
> 
> Many thanks in advance!
> 




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