1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-30 15:49:41 +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"
#if defined(EXPERIMENTAL_CRASH_REPORT)
#include <wx/progdlg.h>
#if defined(__WXMSW__)
#include <wx/evtloop.h>
@ -29,32 +30,59 @@ namespace CrashReport {
void Generate(wxDebugReport::Context ctx)
{
wxDebugReportCompress rpt;
rpt.AddAll(ctx);
wxFileNameWrapper fn{ FileNames::DataDir(), wxT("audacity.cfg") };
rpt.AddFile(fn.GetFullPath(), _TS("Audacity Configuration"));
rpt.AddFile(FileNames::PluginRegistry(), wxT("Plugin Registry"));
rpt.AddFile(FileNames::PluginSettings(), wxT("Plugin Settings"));
if (ctx == wxDebugReport::Context_Current)
// Bug 1927: Seems there problems with wxStackWalker, so don't even include
// the stack trace or memory dump. The former is pretty much useless in Release
// builds anyway and none of use have the skill/time/desire to fiddle with the
// latter.
// rpt.AddAll(ctx);
// 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();
GUIPrefs::InitLang( wxT("en") );
auto cleanup = finally( [&]{ GUIPrefs::InitLang( saveLang ); } );
wxFileNameWrapper fn{ FileNames::DataDir(), wxT("audacity.cfg") };
rpt.AddFile(fn.GetFullPath(), _TS("Audacity Configuration"));
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();
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
auto gAudioIO = AudioIOBase::Get();
rpt.AddText(wxT("audiodev.txt"), gAudioIO->GetDeviceInfo(), wxT("Audio Device Info"));
#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
}
}
auto logger = AudacityLogger::Get();
if (logger)
auto logger = AudacityLogger::Get();
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);
#if defined(__WXMSW__)