Fixed an infinite loop in graphic.c.
Using a new structure to store the gcs.