Browse Source

attempt to fix eternal twirling

David Rose 14 years ago
parent
commit
d592205b57
1 changed files with 8 additions and 3 deletions
  1. 8 3
      direct/src/plugin_npapi/ppInstance.cxx

+ 8 - 3
direct/src/plugin_npapi/ppInstance.cxx

@@ -368,7 +368,7 @@ set_window(NPWindow *window) {
   }
   }
 #endif  // HAVE_GTK
 #endif  // HAVE_GTK
 
 
-  if (!_failed && _p3d_inst == NULL) {
+  if (!_failed && !_started) {
     x11_start_twirl_subprocess();
     x11_start_twirl_subprocess();
   }
   }
 #endif  // HAVE_X11
 #endif  // HAVE_X11
@@ -2837,7 +2837,10 @@ twirl_timer_callback() {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void PPInstance::
 void PPInstance::
 x11_start_twirl_subprocess() {
 x11_start_twirl_subprocess() {
-  assert(_twirl_subprocess_pid == -1);
+  if (_twirl_subprocess_pid == -1) {
+    // Already started.
+    return;
+  }
 
 
   // Fork and exec.
   // Fork and exec.
   pid_t child = fork();
   pid_t child = fork();
@@ -2849,11 +2852,13 @@ x11_start_twirl_subprocess() {
   if (child == 0) {
   if (child == 0) {
     // Here we are in the child process.
     // Here we are in the child process.
     x11_twirl_subprocess_run();
     x11_twirl_subprocess_run();
-    _exit(0);
+    _exit(99);
   }
   }
 
 
   // In the parent process.
   // In the parent process.
   _twirl_subprocess_pid = child;
   _twirl_subprocess_pid = child;
+  cerr << "Started twirl subprocess, pid " << _twirl_subprocess_pid
+       << "\n";
 }
 }
 #endif  // HAVE_X11
 #endif  // HAVE_X11