Hello,
My application is an MDI and on one of the child windows, i need to draw 1500 rectangles to depict the overall status of the system. The drawing is been done on a jpeg image. The drawing is done fine, but as i go on opening and closing the child windows one by one i get the following X-errors while the app is running :

X Error: BadGC (invalid GC parameter) 13
Major opcode: 66
Minor opcode: 0
Resource id: 0x2e0043c
X Error: BadGC (invalid GC parameter) 13
Major opcode: 66
Minor opcode: 0
Resource id: 0x2e0043c
X Error: BadGC (invalid GC parameter) 13
Major opcode: 66
Minor opcode: 0
Resource id: 0x2e0043c..........

My paintevent code is as below :

void CascadeOverview:aintEvent(QPaintEvent *)
{
static int X1,Y1,X2,Y2;
Y1 = 5;
Y2 = 10;
QImage cascadeBG("./images/cascadebackground.png"); // jpeg image
QPixmap bufferCascadeBG(cascadeBG);

if (paintActualArea->isActive())
paintActualArea->end();

if (paintBufferArea->isActive())
paintBufferArea->end();

paintActualArea->begin(pixmapBackground);
paintBufferArea->begin(&bufferCascadeBG);

paintActualArea->setBrush(green);
paintBufferArea->setBrush(green);

for( int i=0;i<1500;i++)
{

paintActualArea->drawRect(X1,Y1,5,10);
paintBufferArea->drawRect(X1,Y1,5,10);

X1= X1+25;
X2 = X2+25;
if(X1>1250)
{
X1=0;
Y1 = Y1+10;
Y2 = Y2+10;
}
if(X2>1250)
{
X2=0;
Y1 = Y1+10;
Y2 = Y2+10;
}

}
bitBlt (pixmapBackground, 0, 0, &bufferCascadeBG);

paintBufferArea->end();
paintActualArea->end();


}


should i detach the image once painter is ended or is there any specific means to release the graphic objects in qt(like GDI in windows)

Thanks for help in advance,
Anitha.