delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/16/06:22:41

From: earnie_boyd AT yahoo DOT com (Earnie Boyd)
Subject: Re: XCreateSimpleWindow and SIGSEGV
16 May 1998 06:22:41 -0700 :
Message-ID: <19980516033401.9215.rocketmail.cygnus.gnu-win32@send1e.yahoomail.com>
Reply-To: earnie_boyd AT yahoo DOT com
Mime-Version: 1.0
To: Glynn Leo <lglynn AT hotmail DOT com>, gnu-win32 AT cygnus DOT com

Your welcome, Glynn,

I've found that SIGSEGV occurs most often, at least for me, when I'm
passing pointers to non-pointers or vice versa.

Use the -Wall switch and take a look at the warnings.

---Glynn Leo <lglynn AT hotmail DOT com> wrote:
>
> Thanx to Earnie 
> I've got my program Compiling 
> I found that XCreateSimpleWindow is giving me 
> SIGSEGV fault Anyone have the same problem
> Have compiled with mmalloc,downloaded the Latest Binaries on NT
> and search archives but to no avail
> Also have X-Server and DISPLAY set
> (Do get the warning message 
>     WinMainCRTStartup ; defaulting to 00401000 )
> 
> Anyone see any problem with the following ?
> thanx
> leo
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <X11/Xlib.h>
> #include <X11/Xutil.h>
> #include <X11/Xatom.h>
> #include "Xstuff.h"
> #include <string.h>
> #include <X11/Xlib.h>
> #include <X11/Xutil.h>
> 
> typedef struct S_window
> {
>   Display*  pDisplay;
>   int       screen;
>   Window    window;
>   GC        gc;
>   int       imageWidth;
>   int       imageHeight;
>   XImage*   pImage;
>   char*     pImageData;
>   XImage*   pSinglePixelImage;
>   Colormap  colorMap;
> } tSwindow;
> 
> 
> tSwindow*
> ScreateWindow(char*  pWindowName, char*  pDisplayName,
> int imageWidth, int imageHeight);
> 
> #define  IMAGE_WIDTH 360
> #define  IMAGE_HEIGHT 240
>  
>  
> main()
>  
> {
>   tSwindow*  pWindow;
>  
>   pWindow = ScreateWindow("rgb_test",
>                             ":0.0",
>                             IMAGE_WIDTH,
>                             IMAGE_HEIGHT);
>  
> }
>  
>  
> tSwindow*
> ScreateWindow(char*  pWindowName,
>                 char*  pDisplayName,
>                 int imageWidth, int imageHeight
>                 )
> {
>   tSwindow*  pReturnValue;
>   XGCValues    gcValues;
>   char*        pWindowBanner;
>  
>   pReturnValue = (tSwindow*)malloc(sizeof(tSwindow));
>  
>  
>   /* Try to connect to the X server */
>   pReturnValue->pDisplay = XOpenDisplay(":0.0");
>   if (pReturnValue->pDisplay == NULL)
>   {
>       free(pReturnValue);
>       return(NULL);
>   }
>  
>   pReturnValue->screen = DefaultScreen(pReturnValue->pDisplay);
>  
>   /* Now, create the window */
>   /* It seems RootWindow() is causing the SIGSEGV */
>   pReturnValue->window =
>         XCreateSimpleWindow(pReturnValue->pDisplay,
>                         RootWindow(pReturnValue->pDisplay,
>                                    pReturnValue->screen),
>                             300,
>                             300,
>                         imageWidth, imageHeight,
>                         4,
>                         BlackPixel(pReturnValue->pDisplay,
>                                    pReturnValue->screen),
>                         WhitePixel(pReturnValue->pDisplay,
>                                    pReturnValue->screen));
> }
>  
>  
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> -
> For help on using this list (especially unsubscribing), send a
message to
> "gnu-win32-request AT cygnus DOT com" with one line of text: "help".
> 

==
-        \\||//
---o0O0--Earnie--0O0o----
--earnie_boyd AT yahoo DOT com--
------ooo0O--O0ooo-------



_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019