diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index 4a37976fc3..8b254e7578 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -66,6 +66,15 @@ P3DInstanceManager() { icc.dwICC = ICC_PROGRESS_CLASS; InitCommonControlsEx(&icc); #endif + +#ifndef _WIN32 + // On Mac or Linux, we'd better ignore SIGPIPE, or this signal will + // shut down the browser if the plugin exits unexpectedly. + struct sigaction ignore; + memset(&ignore, 0, sizeof(ignore)); + ignore.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &ignore, &_old_sigpipe); +#endif // _WIN32 } //////////////////////////////////////////////////////////////////// @@ -84,6 +93,11 @@ P3DInstanceManager:: _started_notify_thread = false; } +#ifndef _WIN32 + // Restore the original SIGPIPE handler. + sigaction(SIGPIPE, &_old_sigpipe, NULL); +#endif // _WIN32 + if (_xcontents != NULL) { delete _xcontents; } diff --git a/direct/src/plugin/p3dInstanceManager.h b/direct/src/plugin/p3dInstanceManager.h index cb848bd903..0faa3d7fc6 100644 --- a/direct/src/plugin/p3dInstanceManager.h +++ b/direct/src/plugin/p3dInstanceManager.h @@ -22,6 +22,10 @@ #include #include +#ifndef _WIN32 +#include +#endif + class P3DInstance; class P3DSession; class P3DPackage; @@ -135,6 +139,10 @@ private: NotifyInstances _notify_instances; P3DConditionVar _notify_ready; +#ifndef _WIN32 + struct sigaction _old_sigpipe; +#endif + static P3DInstanceManager *_global_ptr; }; diff --git a/direct/src/plugin_npapi/startup.cxx b/direct/src/plugin_npapi/startup.cxx index 8bad17464e..e4b709d844 100644 --- a/direct/src/plugin_npapi/startup.cxx +++ b/direct/src/plugin_npapi/startup.cxx @@ -21,10 +21,6 @@ #include #endif -#ifdef __APPLE__ -#include -#endif - static ofstream logfile; ostream *nout_stream = &logfile; @@ -134,12 +130,6 @@ NP_Initialize(NPNetscapeFuncs *browserFuncs, } #endif -#ifdef __APPLE__ - // On Mac, we'd better ignore SIGPIPE, or this signal will shut down - // the application if the plugin exits unexpectedly. - signal(SIGPIPE, SIG_IGN); -#endif // __APPLE__ - return NPERR_NO_ERROR; } diff --git a/direct/src/showutil/Packager.py b/direct/src/showutil/Packager.py index fbef73d5d4..174f0daa68 100644 --- a/direct/src/showutil/Packager.py +++ b/direct/src/showutil/Packager.py @@ -1929,8 +1929,9 @@ class Packager: if filename: newFilename = Filename('/'.join(moduleName.split('.'))) newFilename.setExtension(filename.getExtension()) - package.addFile(filename, newName = newFilename.cStr(), - deleteTemp = True, explicit = True, extract = True) + self.currentPackage.addFile( + filename, newName = newFilename.cStr(), + deleteTemp = True, explicit = True, extract = True) self.currentPackage.mainModule = (moduleName, newName)