'**Assertion `!xcb_xlib_threads_sequence_lost' failed** while running graphics program in C

#include<stdio.h>
#include<graphics.h>
#include<math.h>

int abs (int n)
{
    return ( (n>0) ? n : ( n * (-1)));
}
void DDA(int X0, int Y0, int X1, int Y1)
{

int dx = X1 - X0;
int dy = Y1 - Y0;
int steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy);
float Xinc = dx / (float) steps;
float Yinc = dy / (float) steps;

float X = X0;
float Y = Y0;
int i;
for (  i = 0; i <= steps; i++)
{
    putpixel (X,Y,RED);  
    X += Xinc;          
    Y += Yinc;  
    delay(80);       

  }
 }
int main()
{

int gd = DETECT, gm;
initgraph (&gd, &gm, "");  
int X0 , Y0 , X1 , Y1;
printf("\n Enter the x0 and y0 :");
scanf("%d %d",&X0,&Y0);
printf("\n Enter the x1 and y1 :");
scanf("%d %d",&X1,&Y1);
DDA(X0, Y0, X1, Y1);
return 0;
} 

And compiling it as gcc pr1.c -lgraph, program compiles succesfully but after doing ./a.out (using centOS) while taking user input it gives following error and program aborts :

poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.

Help to resolve this issue .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source