Segmetation fault using assigning a GdkPixmap* to a GdkPixmap& parameter (using C++)



On Thu, May 24, 2001 at 07:29:29PM +0100, Ignacio Nodal wrote:
> Hi,
>
> I want to write a function to read a pixmap string and store it into a
> GdkPixmap, but without having to know which widget it will be added into.By
> the way the widget could be still not created at all.
> The problem is if I use gdk_pixmap_create_from_xpm_d() one of its parameters
> force me to specify a "GdkWindow *window". I'm not using any transparent
> color, so the "style" isn't a real problem for me...
> If I use a non-existing widget I obviously get this error:
> "Gdk-WARNING **: Creating pixmap from xpm with NULL window and colormap"
>

This was written by me a long long time ago ;)) Now, I've been working
again on it.

Helmethead told me to do it using 
pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
gtk_widget_get_default_colormap(),&mask, NULL, xpm_structure);

I used it, and it seems to work fine, the problem is i'm using C++ (yes
yes.. don't tell me to use the Gtk-- again, I already know ;)) and I'm
getting a Segmentation fault  when trying to assign the GdkPixmap
*pixmap returned by "gdk_pixmap_colormap_create_from_xpm_d()" to my
"GdkPixmap& pix" parameter..
Here is my C++ function... 

gboolean ParameterKernel::ReadPixmap(gchar **pixstring, GdkPixmap& pix)
//Reads a pixmap from a xpm-format string & stores it in GdkPixmap& pix
{
  
  GdkPixmap *pixmap;
  GdkBitmap *mask;

  pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
gtk_widget_get_default_colormap(),
  						&mask, NULL, (gchar **) pixstring);


  
  g_print("The program arrives this point\n");
  (GdkPixmap *) pix =  pixmap;
  g_print("Segmentation fault is in the line above\n");
  
  if (&pix == NULL) {return (FALSE);} else {return (TRUE);}

}


...any idea about what can be wrong?

Thanks in advance,
	Ignacio Nodal




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