提交 7ec9f525 编写于 作者: A Alexander Alekhin

highgui: don't terminate if we can't initialize GTK backend

- allow Users to handle such case
- exception will be thrown instead
上级 68f52726
......@@ -612,19 +612,33 @@ static std::vector< Ptr<CvWindow> > g_windows;
CV_IMPL int cvInitSystem( int argc, char** argv )
{
static int wasInitialized = 0;
static bool hasError = false;
// check initialization status
if( !wasInitialized )
{
gtk_init( &argc, &argv );
if (!gtk_init_check(&argc, &argv))
{
hasError = true;
wasInitialized = true;
CV_Error(Error::StsError, "Can't initialize GTK backend");
}
setlocale(LC_NUMERIC,"C");
#ifdef HAVE_OPENGL
gtk_gl_init(&argc, &argv);
if (!gtk_gl_init_check(&argc, &argv))
{
hasError = true;
wasInitialized = true;
CV_Error(Error::StsError, "Can't initialize GTK-OpenGL backend");
}
#endif
wasInitialized = 1;
}
if (hasError)
CV_Error(Error::StsError, "GTK backend is not available");
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册