diff --git a/src/eepp/scene/scenenode.cpp b/src/eepp/scene/scenenode.cpp index 945854d8a..2408d4f61 100644 --- a/src/eepp/scene/scenenode.cpp +++ b/src/eepp/scene/scenenode.cpp @@ -247,7 +247,7 @@ void SceneNode::checkClose() { mCloseList.clear(); for ( Node* node : closeListCopy ) - eeDelete( node ); + eeSAFE_DELETE( node ); } } diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 864ea41a9..4106fb44e 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -571,7 +571,7 @@ void App::onPluginEnabled( Plugin* plugin ) { void App::initPluginManager() { mPluginManager = std::make_unique( - mResPath, mPluginsPath, mThreadPool, + mResPath, mPluginsPath, mConfigPath, mThreadPool, [this]( const std::string& path, const auto& cb ) { UITab* tab = mSplitter->isDocumentOpen( path ); if ( !tab ) { diff --git a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp index 85df33714..0f335d260 100644 --- a/src/tools/ecode/plugins/debugger/debuggerplugin.cpp +++ b/src/tools/ecode/plugins/debugger/debuggerplugin.cpp @@ -61,8 +61,15 @@ DebuggerPlugin::~DebuggerPlugin() { waitUntilLoaded(); mShuttingDown = true; - if ( mSidePanel && mTab ) - mSidePanel->removeTab( mTab ); + if ( mSidePanel && mTab ) { + if ( Engine::isRunninMainThread() ) + mSidePanel->removeTab( mTab ); + else { + auto sidePanel = mSidePanel; + auto tab = mTab; + mSidePanel->runOnMainThread( [sidePanel, tab] { sidePanel->removeTab( tab ); } ); + } + } if ( getPluginContext()->getStatusBar() ) getPluginContext()->getStatusBar()->removeStatusBarElement( "status_app_debugger" ); @@ -619,6 +626,7 @@ void DebuggerPlugin::buildSidePanelTab() { mUIDebuggerList->on( Event::OnValueChange, [this]( const Event* event ) { mCurDebugger = event->getNode()->asType()->getText().toUtf8(); + mCurConfiguration = ""; } ); mUIDebuggerConfList->on( Event::OnValueChange, [this]( const Event* event ) { @@ -667,8 +675,9 @@ void DebuggerPlugin::buildSidePanelTab() { void DebuggerPlugin::updateSelectedDebugConfig() { if ( mUIDebuggerList && mUIDebuggerConfList && !mCurDebugger.empty() ) { mUIDebuggerList->runOnMainThread( [this] { + auto curConfig = mCurConfiguration; mUIDebuggerList->getListBox()->setSelected( mCurDebugger ); - mUIDebuggerConfList->getListBox()->setSelected( mCurConfiguration ); + mUIDebuggerConfList->getListBox()->setSelected( curConfig ); } ); } } @@ -843,9 +852,11 @@ void DebuggerPlugin::updateSidePanelTab() { } if ( !empty ) { - if ( !mCurDebugger.empty() ) + if ( !mCurDebugger.empty() ) { + auto curConfig = mCurConfiguration; mUIDebuggerList->getListBox()->setSelected( mCurDebugger ); - else + mCurConfiguration = std::move( curConfig ); + } else mUIDebuggerList->getListBox()->setSelected( 0L ); } @@ -891,7 +902,7 @@ void DebuggerPlugin::updateDebuggerConfigurationList() { std::string curConfig( mCurConfiguration ); mUIDebuggerConfList->getListBox()->clear(); - mCurConfiguration = curConfig; + mCurConfiguration = std::move( curConfig ); std::string debuggerSelected = mUIDebuggerList->getListBox()->getItemSelectedText().toUtf8(); diff --git a/src/tools/ecode/plugins/pluginmanager.cpp b/src/tools/ecode/plugins/pluginmanager.cpp index 0f8f4f5d3..b614c0e8d 100644 --- a/src/tools/ecode/plugins/pluginmanager.cpp +++ b/src/tools/ecode/plugins/pluginmanager.cpp @@ -2,6 +2,7 @@ #include "../filesystemlistener.hpp" #include "plugin.hpp" #include +#include #include #include #include @@ -11,10 +12,11 @@ using json = nlohmann::json; namespace ecode { PluginManager::PluginManager( const std::string& resourcesPath, const std::string& pluginsPath, - std::shared_ptr pool, const OnLoadFileCb& loadFileCb, - PluginContextProvider* context ) : + const std::string& configPath, std::shared_ptr pool, + const OnLoadFileCb& loadFileCb, PluginContextProvider* context ) : mResourcesPath( resourcesPath ), mPluginsPath( pluginsPath ), + mConfigPath( configPath ), mThreadPool( pool ), mPluginContext( context ), mLoadFileFn( loadFileCb ) {} @@ -262,6 +264,14 @@ void PluginManager::setPluginReloadEnabled( bool pluginReloadEnabled ) { void PluginManager::subscribeMessages( Plugin* plugin, std::function cb ) { + if ( plugin && !mWorkspaceFolder.empty() ) { + std::string projectsPath( mConfigPath + "projects" + FileSystem::getOSSlash() ); + MD5::Result hash = MD5::fromString( mWorkspaceFolder ); + std::string projectPluginsStatePath( projectsPath + "plugins_state" + + FileSystem::getOSSlash() + hash.toHexString() + + FileSystem::getOSSlash() ); + plugin->onLoadProject( mWorkspaceFolder, projectPluginsStatePath ); + } subscribeMessages( plugin->getId(), cb ); } diff --git a/src/tools/ecode/plugins/pluginmanager.hpp b/src/tools/ecode/plugins/pluginmanager.hpp index db73d5ad6..015aed68c 100644 --- a/src/tools/ecode/plugins/pluginmanager.hpp +++ b/src/tools/ecode/plugins/pluginmanager.hpp @@ -275,6 +275,7 @@ class PluginManager { using OnLoadFileCb = std::function; PluginManager( const std::string& resourcesPath, const std::string& pluginsPath, + const std::string& configPath, std::shared_ptr pool, const OnLoadFileCb& loadFileCb, PluginContextProvider* context ); @@ -373,6 +374,7 @@ class PluginManager { friend class App; std::string mResourcesPath; std::string mPluginsPath; + std::string mConfigPath; std::string mWorkspaceFolder; std::map mPlugins; std::map mPluginsEnabled;