]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
gecko:
authorres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 28 Dec 2007 12:55:02 +0000 (12:55 +0000)
committerres <res@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 28 Dec 2007 12:55:02 +0000 (12:55 +0000)
- print gecko error code when embedding object init fails
- print message when browser object creation fails
- crash fix in CL_Gecko_NavigateToURI

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7872 d7cf8633-e32d-0410-b094-e92efae38249

cl_gecko.c

index 007ab107198b2bcf90ad2ed8976c7898a4702442..c4a6f7a5eae383308a1e76487a99211ffe0d688d 100644 (file)
@@ -134,16 +134,17 @@ clgecko_t * CL_Gecko_CreateBrowser( const char *name ) {
        \r
        if( cl_geckoembedding == NULL ) {\r
                char profile_path [MAX_OSPATH];\r
+               OSGK_GeckoResult grc;\r
 \r
                OSGK_EmbeddingOptions *options = osgk_embedding_options_create();\r
                osgk_embedding_options_add_search_path( options, "./xulrunner/" );\r
                dpsnprintf (profile_path, sizeof (profile_path), "%s/xulrunner_profile/", fs_gamedir);\r
                osgk_embedding_options_set_profile_dir( options, profile_path, 0 );\r
-               cl_geckoembedding = osgk_embedding_create_with_options( options, NULL );\r
+               cl_geckoembedding = osgk_embedding_create_with_options( options, &grc );\r
                osgk_release( options );\r
                \r
                if( cl_geckoembedding == NULL ) {\r
-                       Con_Printf( "CL_Gecko_CreateBrowser: Couldn't retrieve gecko embedding object!\n" );\r
+                       Con_Printf( "CL_Gecko_CreateBrowser: Couldn't retrieve gecko embedding object (%.8x)!\n", grc );\r
                        return NULL;\r
                }\r
        }\r
@@ -151,6 +152,9 @@ clgecko_t * CL_Gecko_CreateBrowser( const char *name ) {
        instance->active = true;\r
        strlcpy( instance->name, name, sizeof( instance->name ) );\r
        instance->browser = osgk_browser_create( cl_geckoembedding, DEFAULT_GECKO_SIZE, DEFAULT_GECKO_SIZE );\r
+       if( instance->browser == NULL ) {\r
+               Con_Printf( "CL_Gecko_CreateBrowser: Browser object creation failed!\n" );\r
+       }\r
        // TODO: assert != NULL\r
 \r
        instance->width = instance->texWidth = DEFAULT_GECKO_SIZE;\r
@@ -351,7 +355,11 @@ void CL_Gecko_Init( void )
 }\r
 \r
 void CL_Gecko_NavigateToURI( clgecko_t *instance, const char *URI ) {\r
-       if( instance && instance->active ) {\r
+       if( !instance || !instance->browser ) {\r
+               return;\r
+       }\r
+\r
+       if( instance->active ) {\r
                osgk_browser_navigate( instance->browser, URI );\r
        }\r
 }\r