1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Bug 1927 - Help > Generate Support Data crashes Audacity

This commit is contained in:
Leland Lucius 2021-02-09 12:31:04 -06:00
parent c3013af661
commit 407fa67a74

View File

@ -11,6 +11,7 @@
#include "Experimental.h" #include "Experimental.h"
#if defined(EXPERIMENTAL_CRASH_REPORT) #if defined(EXPERIMENTAL_CRASH_REPORT)
#include <wx/progdlg.h>
#if defined(__WXMSW__) #if defined(__WXMSW__)
#include <wx/evtloop.h> #include <wx/evtloop.h>
@ -29,32 +30,59 @@ namespace CrashReport {
void Generate(wxDebugReport::Context ctx) void Generate(wxDebugReport::Context ctx)
{ {
wxDebugReportCompress rpt; wxDebugReportCompress rpt;
rpt.AddAll(ctx);
// Bug 1927: Seems there problems with wxStackWalker, so don't even include
wxFileNameWrapper fn{ FileNames::DataDir(), wxT("audacity.cfg") }; // the stack trace or memory dump. The former is pretty much useless in Release
rpt.AddFile(fn.GetFullPath(), _TS("Audacity Configuration")); // builds anyway and none of use have the skill/time/desire to fiddle with the
rpt.AddFile(FileNames::PluginRegistry(), wxT("Plugin Registry")); // latter.
rpt.AddFile(FileNames::PluginSettings(), wxT("Plugin Settings")); // rpt.AddAll(ctx);
if (ctx == wxDebugReport::Context_Current) // Provides a progress dialog with indeterminate mode
wxGenericProgressDialog pd(XO("Audacity Support Data").Translation(),
XO("This may take several seconds").Translation(),
300000, // range
nullptr, // parent
wxPD_APP_MODAL | wxPD_ELAPSED_TIME | wxPD_SMOOTH);
std::atomic_bool done = {false};
auto thread = std::thread([&]
{ {
auto saveLang = GUIPrefs::GetLangShort(); wxFileNameWrapper fn{ FileNames::DataDir(), wxT("audacity.cfg") };
GUIPrefs::InitLang( wxT("en") ); rpt.AddFile(fn.GetFullPath(), _TS("Audacity Configuration"));
auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } ); rpt.AddFile(FileNames::PluginRegistry(), wxT("Plugin Registry"));
rpt.AddFile(FileNames::PluginSettings(), wxT("Plugin Settings"));
if (ctx == wxDebugReport::Context_Current)
{
auto saveLang = GUIPrefs::GetLangShort();
GUIPrefs::InitLang( wxT("en") );
auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } );
auto gAudioIO = AudioIOBase::Get(); auto gAudioIO = AudioIOBase::Get();
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info")); rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT
rpt.AddText(wxT("mididev.txt"), gAudioIO->GetMidiDeviceInfo(), wxT("MIDI Device Info")); rpt.AddText(wxT("mididev.txt"), gAudioIO->GetMidiDeviceInfo(), wxT("MIDI Device Info"));
#endif #endif
} }
auto logger = AudacityLogger::Get(); auto logger = AudacityLogger::Get();
if (logger) if (logger)
{
rpt.AddText(wxT("log.txt"), logger->GetLog(), _TS("Audacity Log"));
}
done = true;
});
// Wait for information to be gathered
while (!done)
{ {
rpt.AddText(wxT("log.txt"), logger->GetLog(), _TS("Audacity Log")); wxMilliSleep(50);
pd.Pulse();
} }
thread.join();
bool ok = wxDebugReportPreviewStd().Show(rpt); bool ok = wxDebugReportPreviewStd().Show(rpt);
#if defined(__WXMSW__) #if defined(__WXMSW__)