reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit ad0c4f00d00673888c2011be580f599a643862be
parent 9de3174e1660c8774902d31bad7109b001066434
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Mon, 27 Mar 2017 20:02:25 -0400

browser: fix post-transation reload (regression from 9de3174e1660c8774902d31bad7109b001066434)

Diffstat:
Msrc/reapack.cpp | 18+++++++++++++++---
Msrc/reapack.hpp | 1+
2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/reapack.cpp b/src/reapack.cpp @@ -76,7 +76,7 @@ std::string ReaPack::resourcePath() ReaPack::ReaPack(REAPER_PLUGIN_HINSTANCE instance) : syncAction(), browseAction(), importAction(), configAction(), m_tx(nullptr), m_progress(nullptr), m_browser(nullptr), m_manager(nullptr), - m_about(nullptr), m_instance(instance) + m_about(nullptr), m_inhibitBrowser(false), m_instance(instance) { m_mainWindow = GetMainHwnd(); m_useRootPath = new UseRootPath(resourcePath()); @@ -325,7 +325,6 @@ Transaction *ReaPack::setupTransaction() Dialog::Show<Report>(m_instance, m_mainWindow, *m_tx->receipt()); } - refreshBrowser(); }); m_tx->setObsoleteHandler([=] (vector<Registry::Entry> &entries) { @@ -346,6 +345,10 @@ void ReaPack::teardownTransaction() { delete m_tx; m_tx = nullptr; + + // Update the browser only after the transaction is deleted because + // it must be able to start a new one to load the indexes + refreshBrowser(); } void ReaPack::refreshManager() @@ -356,8 +359,17 @@ void ReaPack::refreshManager() void ReaPack::refreshBrowser() { - if(m_browser) + if(!m_browser) + return; + + if(m_inhibitBrowser) + m_inhibitBrowser = false; + else { + // set prenvively in case the transaction finishes immediately (eg. nothing to dl) + m_inhibitBrowser = true; m_browser->refresh(); + m_inhibitBrowser = m_tx != nullptr; + } } void ReaPack::registerSelf() diff --git a/src/reapack.hpp b/src/reapack.hpp @@ -90,6 +90,7 @@ private: Manager *m_manager; About *m_about; + bool m_inhibitBrowser; REAPER_PLUGIN_HINSTANCE m_instance; HWND m_mainWindow; UseRootPath *m_useRootPath;