Browse Source

fix firefox crash on osx

David Rose 16 years ago
parent
commit
c1fea52cab

+ 5 - 0
direct/src/plugin/p3dSession.cxx

@@ -738,6 +738,10 @@ start_p3dpython() {
   env += _python_root_dir;
   env += _python_root_dir;
   env += '\0';
   env += '\0';
 
 
+  env += "PYTHONHOME=";
+  env += _python_root_dir;
+  env += '\0';
+
   env += "PRC_DIR=";
   env += "PRC_DIR=";
   env += _python_root_dir;
   env += _python_root_dir;
   env += '\0';
   env += '\0';
@@ -746,6 +750,7 @@ start_p3dpython() {
   env += _python_root_dir;
   env += _python_root_dir;
   env += '\0';
   env += '\0';
 
 
+  nout << "Attempting to start python from " << p3dpython << "\n";
 #ifdef _WIN32
 #ifdef _WIN32
   _p3dpython_handle = win_create_process
   _p3dpython_handle = win_create_process
     (p3dpython, _python_root_dir, env, _output_filename,
     (p3dpython, _python_root_dir, env, _output_filename,

+ 12 - 0
direct/src/plugin_npapi/ppBrowserObject.cxx

@@ -246,6 +246,18 @@ eval(const string &expression) const {
   return object;
   return object;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: PPBrowserObject::clear_class_definition
+//       Access: Public, Static
+//  Description: Should be called when the core API is unloaded, and
+//               the associated class definition object is therefore
+//               invalidated.
+////////////////////////////////////////////////////////////////////
+void PPBrowserObject::
+clear_class_definition() {
+  _browser_object_class = NULL;
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: PPBrowserObject::get_class_definition
 //     Function: PPBrowserObject::get_class_definition
 //       Access: Private, Static
 //       Access: Private, Static

+ 2 - 0
direct/src/plugin_npapi/ppBrowserObject.h

@@ -43,6 +43,8 @@ public:
                    P3D_object *params[], int num_params) const;
                    P3D_object *params[], int num_params) const;
   P3D_object *eval(const string &expression) const;
   P3D_object *eval(const string &expression) const;
 
 
+  static void clear_class_definition();
+
 private:
 private:
   static P3D_class_definition *get_class_definition();
   static P3D_class_definition *get_class_definition();
 
 

+ 1 - 0
direct/src/plugin_npapi/ppInstance.cxx

@@ -932,6 +932,7 @@ do_load_plugin() {
   }
   }
 #endif  // P3D_PLUGIN_P3D_PLUGIN
 #endif  // P3D_PLUGIN_P3D_PLUGIN
 
 
+  nout << "Attempting to load core API from " << pathname << "\n";
   if (!load_plugin(pathname, "", "", "")) {
   if (!load_plugin(pathname, "", "", "")) {
     nout << "Unable to launch core API in " << pathname << "\n";
     nout << "Unable to launch core API in " << pathname << "\n";
     return;
     return;

+ 2 - 0
direct/src/plugin_npapi/startup.cxx

@@ -15,6 +15,7 @@
 #include "startup.h"
 #include "startup.h"
 #include "p3d_plugin_config.h"
 #include "p3d_plugin_config.h"
 #include "p3d_lock.h"
 #include "p3d_lock.h"
+#include "ppBrowserObject.h"
 
 
 #ifdef _WIN32
 #ifdef _WIN32
 #include <malloc.h>
 #include <malloc.h>
@@ -183,6 +184,7 @@ NPError OSCALL
 NP_Shutdown(void) {
 NP_Shutdown(void) {
   nout << "shutdown\n";
   nout << "shutdown\n";
   unload_plugin();
   unload_plugin();
+  PPBrowserObject::clear_class_definition();
 
 
   // Not clear whether there's a return value or not.  Some versions
   // Not clear whether there's a return value or not.  Some versions
   // of the API have different opinions on this.
   // of the API have different opinions on this.