Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
fix create-compilation-databases event sent from Sourcetrail via sock…
Browse files Browse the repository at this point in the history
…et was handled in non-ui thread
  • Loading branch information
mlangkabel committed Jul 2, 2019
1 parent 30cadee commit 202e143
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions SourcetrailExtension/SourcetrailExtensionPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,26 @@ async delegate
else if(messageType == Utility.NetworkProtocolUtility.MESSAGE_TYPE.CREATE_CDB)
{
Logging.Logging.LogInfo("Received request to create a compilation database.");
if(_validSolutionLoaded)
if (_validSolutionLoaded)
{
DTE dte = (DTE)GetService(typeof(DTE));
ThreadHelper.JoinableTaskFactory.Run(
async delegate
{
// Switch to main thread
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
DTE dte = (DTE)GetService(typeof(DTE));

CreateCompilationDatabase(dte);
CreateCompilationDatabase(dte);
}
);
}
else
{
Logging.Logging.LogInfo(
"No C/C++ project was detected. To use the Sourcetrail Extension, please make " +
"sure that the loaded Visual Studio Solution contains at least one C/C++ project " +
"and Visual Studio is configured to generate a symbol database " +
"(Tools->Options->Text Editor->C/C++->Advanced->Browsing/Navigation->Disable Database = False).");
}
}
else if(messageType == Utility.NetworkProtocolUtility.MESSAGE_TYPE.PING)
Expand Down

0 comments on commit 202e143

Please sign in to comment.