Here's another update...
I've located what goes wrong when Cygwin/X crashes.
In shadow.c, shadowSetup() sets all functionpointers, pScreen->CreateGC, 
pScreen->PaintWindowBackground etc..
then in the functions shadowCreateGC, shadowPaintWindow etc.. the screen privates are 
retreived ,shadowScrPriv(), then the function pointers are set again using the unwrap 
macro
#define unwrap(priv, real, mem) {\
    real->mem = priv->mem; \
}
In shadowPaintWindow for example.
shadowScrPriv(pScreen);  //retreive screen privates
if(what == PW_BACKGROUND) {
   unwrap (pScrPriv, pScreen, PaintWindowBackground);  //set the function pointer
   (*pScreen->PaintWindowBackground) (pWindow, prgn, what); //paint
   wrap (pScrPriv, pScreen, PaintWindowBackground, shadowPaintWindow);

98% of the time the functionpointers are set correctly, although sometimes they are 
completely bananas and are set to 0x99 or 0xff which causes XWin to crash immediately. 
I've "corrected" the effect of this bug by adding if(((int)pScreen->GetImage & 
0xffffff00) == NULL)
        pScreen->GetImage = 0x4b8bf9;
and respectively for pScreen->PaintWindowBackground etc...
So now whenever a functionpointer gets corrupted XWin doesn't crash and I can debug 
and continue monitoring the functionpointers. It must be because shadowScrPriv(), 
shadow.h

#define shadowGetScrPriv(pScr)  ((shadowScrPrivPtr) 
(pScr)->devPrivates[shadowScrPrivateIndex].ptr)
#define shadowScrPriv(pScr)     shadowScrPrivPtr    pScrPriv = shadowGetScrPriv(pScr)

retreives incorrect screen privates. But why? I'm not familiar enough with the code to 
figure it out.
Hopefully some of you will have some ideas on this ;)
Cheers,
   Sebastian Habyters are set correctly, alth

Reply via email to