After inserting a video card a gtkmm application crashes with BadWindow (X Window System error)

I am writing a gtkmm application with OpenCascade to work with models - Linux. On my old pc - without a video card this application was working slow, so I decided to place a video card inside. When I am trying to initialize a context ( Handle(OpenGl_Context) aGlCtx = new OpenGl_Context(); aGlCtx->Init(true); ) - the application crashes with the error above. When I was rendering without the video card the application started without any errors. The command glxinfo -B shows Preffered profile: core. Without the video card - Preffered profile: compatible. Probably it may help