File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -612,19 +612,33 @@ static std::vector< Ptr<CvWindow> > g_windows;
612
612
CV_IMPL int cvInitSystem ( int argc, char ** argv )
613
613
{
614
614
static int wasInitialized = 0 ;
615
+ static bool hasError = false ;
615
616
616
617
// check initialization status
617
618
if ( !wasInitialized )
618
619
{
619
- gtk_init ( &argc, &argv );
620
+ if (!gtk_init_check (&argc, &argv))
621
+ {
622
+ hasError = true ;
623
+ wasInitialized = true ;
624
+ CV_Error (Error::StsError, " Can't initialize GTK backend" );
625
+ }
626
+
620
627
setlocale (LC_NUMERIC," C" );
621
628
622
629
#ifdef HAVE_OPENGL
623
- gtk_gl_init (&argc, &argv);
630
+ if (!gtk_gl_init_check (&argc, &argv))
631
+ {
632
+ hasError = true ;
633
+ wasInitialized = true ;
634
+ CV_Error (Error::StsError, " Can't initialize GTK-OpenGL backend" );
635
+ }
624
636
#endif
625
637
626
638
wasInitialized = 1 ;
627
639
}
640
+ if (hasError)
641
+ CV_Error (Error::StsError, " GTK backend is not available" );
628
642
629
643
return 0 ;
630
644
}
You can’t perform that action at this time.
0 commit comments