glColor4f fails to set color

In my application for one particular case

glColor4f()

is not working.

  1. If I use
glGetFloatv(GL_CURRENT_COLOR, color)

it will return previously set color value. (lighting is disabled )

  1. My current object is rendered with previous set color.

If I put

glFlush()

just before the

glColor4f()

, it works properly.

Also above issue is not reproducible when I use gDebugger, xCaptain, CodeXL or Visual Studio to debug my application.
How should I proceed to get exact issue?