(gtk_pixmap_new): assertion `val != NULL' failed



Ronald Bultje wrote:
> 
> Hi Ignacio,
> 
> [...]
. Why not try this:
> 
> gboolean ParameterKernel::ReadPixmap(gchar **pixstring, GdkPixmap *pix)
>                                     /* "&" changed into "*" */
> [...]
>   GdkPixmap *pixmap;
> [...]
>   pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
> gtk_widget_get_default_colormap(), ...
> [...]
>   pix =  pixmap; /* got rid of the "*" because you're allocating a
>                     pointer to a pointer - so they're the same */
> 
> That's the good way of doing it, I guess.
> Regards,
> 
> Ronald

This avoids the segmentation fault... but then.. when I use
gtk_pixmap_new() I get this other error:

"Gtk-CRITICAL **: file gtkpixmap.c: line 97 (gtk_pixmap_new): assertion
`val != NULL' failed."

Here is the part of the code involve...

Somewhere in the main program I create a button, ParameterButton is
subclass of ParameterKernel
[...]
ParameterButton* button = new ParameterButton(PixmapButton);
[...]
Then I call the ReadPixmap function in the class constructor:
if (_type = PixmapButton) { _pixmap_read = ReadPixmap(pixstring,
_pixmap);}
[...]

Then I try to use my "stored" _pixmap, declared as GdkPixmap* _pixmap
being a field of the ParameterButton class, in another member-function I
have to create/show the buttons:
[...]
if (_pixmap_read) {
  GtkWidget* pixmapwidget;
  g_print("_pixmap_read seems to have been correctly updated\n");
  if (_pixmap == NULL) { g_print("Why the hell isn't my GdkPixmap*
_pixmap correctly updated ;(\n");}
  pixmapwidget = gtk_pixmap_new( _pixmap, NULL );
  gtk_widget_show( pixmapwidget);
  gtk_container_add(GTK_CONTAINER(_button), pixmapwidget);
[...]

Why isn't my _pixmap field being updated? 

Thanks again and again and again ;)

	Ignacio Nodal




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