mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-16 08:34:10 +02:00
Mac: Don't execve in main or fork & crash to evade its ill effects...
This at once reverts fixes for bugs 543 and 290; 290 being a problem loading libraries, 543 being a minor problem with the fix for 290, resulting in a rewrite of the fix, but this rewrite having bad consequences, as in bugs 1567 and 1703. See discussion in bug 1702 for the detailed history See also commits a05d039055909d7d1dc2d4f31e1fe0659a3207dd (fork and crash) 36361a6b86dac4b0f2b16b7017007b4cc7717c7a (introduced execve)
This commit is contained in:
parent
32f3ccd08e
commit
e359383d3b
@ -651,54 +651,12 @@ public:
|
||||
};
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
// This should be removed when Lame and FFmpeg support is converted
|
||||
// from loadable libraries to commands.
|
||||
//
|
||||
// The purpose of this is to give the user more control over where libraries
|
||||
// such as Lame and FFmpeg get loaded from.
|
||||
//
|
||||
// Since absolute pathnames are used when loading these libraries, the normal search
|
||||
// path would be DYLD_LIBRARY_PATH, absolute path, DYLD_FALLBACK_LIBRARY_PATH. This
|
||||
// means that DYLD_LIBRARY_PATH can override what the user actually wants.
|
||||
//
|
||||
// So, we simply clear DYLD_LIBRARY_PATH to allow the users choice to be the first
|
||||
// one tried.
|
||||
|
||||
IMPLEMENT_APP_NO_MAIN(AudacityApp)
|
||||
IMPLEMENT_WX_THEME_SUPPORT
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
bool doCrash = false;
|
||||
|
||||
#ifdef FIX_BUG1567
|
||||
doCrash = AudacityApp::IsSierraOrLater();
|
||||
#endif
|
||||
|
||||
bool doExec = !doCrash && getenv("DYLD_LIBRARY_PATH");
|
||||
unsetenv("DYLD_LIBRARY_PATH");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
#ifdef FIX_BUG1567
|
||||
const char *var_name = "_NO_CRASH";
|
||||
if ( doCrash && !( getenv( var_name ) ) ) {
|
||||
setenv(var_name, "1", TRUE);
|
||||
// Bizarre fix for Bug1567
|
||||
// Crashing one Audacity and immediately starting another avoids intermittent
|
||||
// failures to load libraries on Sierra
|
||||
if ( fork() )
|
||||
// The original process crashes at once
|
||||
raise(SIGTERM);
|
||||
|
||||
// Child process can't proceed until doing this:
|
||||
execve(argv[0], argv, environ);
|
||||
}
|
||||
else
|
||||
#else
|
||||
if (doExec)
|
||||
execve(argv[0], argv, environ);
|
||||
#endif
|
||||
|
||||
wxDISABLE_DEBUG_SUPPORT();
|
||||
|
||||
return wxEntry(argc, argv);
|
||||
@ -1542,12 +1500,6 @@ bool AudacityApp::OnInit()
|
||||
temporarywindow.SetTitle(_("Audacity is starting up..."));
|
||||
SetTopWindow(&temporarywindow);
|
||||
|
||||
#ifdef FIX_BUG1567
|
||||
// Without this, splash screen may be hidden under other programs.
|
||||
if (IsSierraOrLater())
|
||||
MacActivateApp();
|
||||
#endif
|
||||
|
||||
// ANSWER-ME: Why is YieldFor needed at all?
|
||||
//wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI|wxEVT_CATEGORY_USER_INPUT|wxEVT_CATEGORY_UNKNOWN);
|
||||
wxEventLoopBase::GetActive()->YieldFor(wxEVT_CATEGORY_UI);
|
||||
|
@ -164,12 +164,7 @@ class AudacityApp final : public wxApp {
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
#if ! defined(__WXDEBUG__)
|
||||
#define FIX_BUG1567
|
||||
#endif
|
||||
|
||||
void MacActivateApp();
|
||||
static bool IsSierraOrLater();
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -92,9 +92,3 @@ void AudacityApp::MacActivateApp()
|
||||
if ( [app respondsToSelector:@selector(activateIgnoringOtherApps:)] )
|
||||
[app activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
bool AudacityApp::IsSierraOrLater()
|
||||
{
|
||||
auto number = kCFCoreFoundationVersionNumber;
|
||||
return number >= 1348.1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user