diff --git a/adapters/standalone.cpp b/adapters/standalone.cpp index 6b3e303f..0f051865 100644 --- a/adapters/standalone.cpp +++ b/adapters/standalone.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -175,6 +176,7 @@ int main(int argc, char* argv[]) { keyboard::init(); gamepad::init(); plugin::init(); + app::browserInit(); library::init(); discord::init(); if (!settings::headless) { diff --git a/include/app/Browser.hpp b/include/app/Browser.hpp index 72880b47..65a1ff26 100644 --- a/include/app/Browser.hpp +++ b/include/app/Browser.hpp @@ -7,6 +7,7 @@ namespace rack { namespace app { +PRIVATE void browserInit(); PRIVATE widget::Widget* browserCreate(); diff --git a/src/app/Browser.cpp b/src/app/Browser.cpp index cb486882..4cea2a33 100644 --- a/src/app/Browser.cpp +++ b/src/app/Browser.cpp @@ -41,12 +41,10 @@ namespace browser { static fuzzysearch::Database modelDb; -static bool modelDbInitialized = false; -static void fuzzySearchInit() { - if (modelDbInitialized) - return; +static void modelDbInit() { + modelDb = fuzzysearch::Database(); modelDb.setWeights({1.f, 1.f, 0.1f, 1.f, 0.5f, 0.5f}); modelDb.setThreshold(0.25f); @@ -75,8 +73,6 @@ static void fuzzySearchInit() { modelDb.addEntry(model, fields); } } - - modelDbInitialized = true; } @@ -731,8 +727,6 @@ struct Browser : widget::OpaqueWidget { } } else { - // Lazily initialize search database - fuzzySearchInit(); // Score results against search query auto results = modelDb.search(search); // DEBUG("============="); @@ -1013,6 +1007,12 @@ inline void ZoomButton::onAction(const ActionEvent& e) { } // namespace browser + +void browserInit() { + browser::modelDbInit(); +} + + widget::Widget* browserCreate() { browser::BrowserOverlay* overlay = new browser::BrowserOverlay; overlay->bgColor = nvgRGBAf(0, 0, 0, 0.33); diff --git a/src/app/TipWindow.cpp b/src/app/TipWindow.cpp index f4ac59e7..39f86f33 100644 --- a/src/app/TipWindow.cpp +++ b/src/app/TipWindow.cpp @@ -32,7 +32,7 @@ struct TipInfo { // Remember to use “smart quotes.” -static std::vector tipInfos = { +static const std::vector tipInfos = { {"To add a module to your patch, right-click an empty rack space or press Enter. Click and drag a module from the Module Browser into the desired rack space.\n\nYou can force-move modules by holding " RACK_MOD_CTRL_NAME " while dragging them.\n\nClick and drag on empty rack space to select multiple modules.", "", ""}, {"Pan around the rack by using the scroll bars, dragging while holding the middle mouse button, " RACK_MOD_ALT_NAME "+clicking and dragging, or pressing the arrow keys. Arrow key panning speed can be modified by holding " RACK_MOD_CTRL_NAME ", " RACK_MOD_SHIFT_NAME ", or " RACK_MOD_CTRL_NAME "+" RACK_MOD_SHIFT_NAME ".\n\nZoom in and out using the View menu, " RACK_MOD_CTRL_NAME "+scroll, or " RACK_MOD_CTRL_NAME "+= and " RACK_MOD_CTRL_NAME "+minus.", "", ""}, // {"Want to use VCV Rack as a plugin in your DAW? VCV Rack Studio Edition is available now as a 64-bit VST 2 plugin for Ableton Live, FL Studio, Reason, REAPER, Bitwig, and more.", "Learn more", "https://vcvrack.com/Rack"}, @@ -158,7 +158,7 @@ struct TipWindow : widget::OpaqueWidget { // Increment tip index settings::tipIndex = math::eucMod(settings::tipIndex + delta, (int) tipInfos.size()); - TipInfo& tipInfo = tipInfos[settings::tipIndex]; + const TipInfo& tipInfo = tipInfos[settings::tipIndex]; label->text = tipInfo.text; linkButton->setVisible(tipInfo.linkText != ""); linkButton->text = tipInfo.linkText; diff --git a/src/logger.cpp b/src/logger.cpp index 5454435c..6132e47f 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -49,6 +49,7 @@ static bool isTruncated() { void init() { assert(!outputFile); std::lock_guard lock(mutex); + truncated = false; // Don't open a file in development mode. if (logPath.empty()) { diff --git a/src/network.cpp b/src/network.cpp index e55c62ac..365d4643 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -70,7 +70,8 @@ void init() { void destroy() { curl_global_cleanup(); - OPENSSL_cleanup(); + // Don't destroy OpenSSL because it's not designed to be reinitialized. + // OPENSSL_cleanup(); }