Skip to content

Commit

Permalink
Never use Sentry when building _DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
christofmuc committed Jun 8, 2021
1 parent 2d5e671 commit 76e36c1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions The-Orm/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#endif
#endif

#ifndef _DEBUG
#ifdef USE_SENTRY
#include "sentry.h"
#include "sentry-config.h"
Expand Down Expand Up @@ -54,6 +55,7 @@ static void sentryLogger(sentry_level_t level, const char *message, va_list args
}
}
#endif
#endif

//==============================================================================
class TheOrmApplication : public JUCEApplication, private ChangeListener
Expand Down Expand Up @@ -99,6 +101,7 @@ class TheOrmApplication : public JUCEApplication, private ChangeListener
}
mainWindow = std::make_unique<MainWindow> (getWindowTitle());

#ifndef _DEBUG
#ifdef USE_SENTRY
// Initialize sentry for error crash reporting
sentry_options_t *options = sentry_options_new();
Expand Down Expand Up @@ -126,6 +129,7 @@ class TheOrmApplication : public JUCEApplication, private ChangeListener

// Fire a test event to see if Sentry actually works
sentry_capture_event(sentry_value_new_message_event(SENTRY_LEVEL_INFO,"custom","Launching KnobKraft Orm"));
#endif
#endif

// Window Title Refresher
Expand Down Expand Up @@ -170,9 +174,11 @@ class TheOrmApplication : public JUCEApplication, private ChangeListener
Settings::instance().saveAndClose();
Settings::shutdown();

#ifndef _DEBUG
#ifdef USE_SENTRY
// Sentry shutdown
sentry_shutdown();
#endif
#endif
}

Expand Down
10 changes: 10 additions & 0 deletions The-Orm/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@

#include "LayoutConstants.h"

#ifndef _DEBUG
#ifdef USE_SENTRY
#include "sentry.h"
#endif
#endif

#ifdef USE_SPARKLE
#include "BinaryData.h"
Expand Down Expand Up @@ -171,9 +173,11 @@ MainComponent::MainComponent(bool makeYourOwnSize) :
{3, { "Categories", { { "Edit auto-categories" }, { "Edit category import mapping" }, { "Rerun auto categorize" } } } },
{4, { "View", { { "Scale 75%" }, { "Scale 100%" }, { "Scale 125%" }, { "Scale 150%" }, { "Scale 175%" }, { "Scale 200%" }}}},
{5, { "Help", {
#ifndef _DEBUG
#ifdef USE_SENTRY
{ "Crash software.."},
{ "Crash reporting consent" },
#endif
#endif
{ "Check for updates..." },
{ "About" } } } }
Expand Down Expand Up @@ -266,6 +270,7 @@ MainComponent::MainComponent(bool makeYourOwnSize) :
SystemClipboard::copyTextToClipboard(buffer.str());
}
}}},
#ifndef _DEBUG
#ifdef USE_SENTRY
{ "Crash reporting consent...", { "Crash reporting consent", [this] {
checkUserConsent();
Expand All @@ -274,6 +279,7 @@ MainComponent::MainComponent(bool makeYourOwnSize) :
crashTheSoftware();
}}},
#endif
#endif
#ifdef USE_SPARKLE
{ "Check for updates...", { "Check for updates...", [this] {
#ifdef WIN32
Expand Down Expand Up @@ -397,6 +403,7 @@ MainComponent::MainComponent(bool makeYourOwnSize) :
#endif
});

#ifndef _DEBUG
#ifdef USE_SENTRY
auto consentAlreadyGiven = Settings::instance().get("SentryConsent", "unknown");
if (consentAlreadyGiven == "unknown") {
Expand All @@ -411,6 +418,7 @@ MainComponent::MainComponent(bool makeYourOwnSize) :
}
}
#endif
#endif
}

MainComponent::~MainComponent()
Expand Down Expand Up @@ -550,6 +558,7 @@ void MainComponent::persistRecentFileList()
Settings::instance().set("RecentFiles", recentFiles_.toString().toStdString());
}

#ifndef _DEBUG
#ifdef USE_SENTRY
void MainComponent::checkUserConsent()
{
Expand All @@ -571,6 +580,7 @@ void MainComponent::checkUserConsent()
}
}
#endif
#endif

void MainComponent::crashTheSoftware()
{
Expand Down
2 changes: 2 additions & 0 deletions The-Orm/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ class MainComponent : public Component, private ChangeListener
PopupMenu recentFileMenu();
void recentFileSelected(int selected);
void persistRecentFileList();
#ifndef _DEBUG
#ifdef USE_SENTRY
void checkUserConsent();
#endif
#endif
void crashTheSoftware();

Expand Down

0 comments on commit 76e36c1

Please sign in to comment.