mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-22 17:48:01 +02:00
Fixed thread safety issue
This commit is contained in:
parent
b6e2be1e99
commit
36e0a3a375
1 changed files with 29 additions and 4 deletions
|
@ -20,8 +20,17 @@ namespace IDE.ui
|
||||||
public static String sUnlockedProjects = "Unlocked Projects";
|
public static String sUnlockedProjects = "Unlocked Projects";
|
||||||
public static String sEntireSolution = "Entire Solution";
|
public static String sEntireSolution = "Entire Solution";
|
||||||
public static String[] sLocationStrings = new .(sCurrentDocument, sCurrentProject, sUnlockedProjects, sEntireSolution) ~ delete _;
|
public static String[] sLocationStrings = new .(sCurrentDocument, sCurrentProject, sUnlockedProjects, sEntireSolution) ~ delete _;
|
||||||
|
|
||||||
List<String> mPendingLines = new List<String>() ~ DeleteContainerAndItems!(_);
|
class QueuedEntry
|
||||||
|
{
|
||||||
|
public String mFileName ~ delete _;
|
||||||
|
public int32 mLine;
|
||||||
|
public int32 mColumn;
|
||||||
|
public String mText ~ delete _;
|
||||||
|
}
|
||||||
|
|
||||||
|
Queue<String> mPendingLines = new .() ~ DeleteContainerAndItems!(_);
|
||||||
|
Queue<QueuedEntry> mQueuedEntries = new .() ~ DeleteContainerAndItems!(_);
|
||||||
|
|
||||||
int32 mCurLineNum;
|
int32 mCurLineNum;
|
||||||
HashSet<String> mFoundPathSet ~ DeleteContainerAndItems!(_);
|
HashSet<String> mFoundPathSet ~ DeleteContainerAndItems!(_);
|
||||||
|
@ -278,7 +287,8 @@ namespace IDE.ui
|
||||||
mSearchThread.Join();
|
mSearchThread.Join();
|
||||||
DeleteAndNullify!(mSearchThread);
|
DeleteAndNullify!(mSearchThread);
|
||||||
DeleteAndNullify!(mSearchOptions);
|
DeleteAndNullify!(mSearchOptions);
|
||||||
ClearAndDeleteItems(mPendingLines);
|
mPendingLines.ClearAndDeleteItems();
|
||||||
|
mQueuedEntries.ClearAndDeleteItems();
|
||||||
DeleteContainerAndItems!(mSearchPaths);
|
DeleteContainerAndItems!(mSearchPaths);
|
||||||
mSearchPaths = null;
|
mSearchPaths = null;
|
||||||
DeleteContainerAndItems!(mFoundPathSet);
|
DeleteContainerAndItems!(mFoundPathSet);
|
||||||
|
@ -586,7 +596,15 @@ namespace IDE.ui
|
||||||
|
|
||||||
public void QueueLine(String fileName, int32 line, int32 column, String text)
|
public void QueueLine(String fileName, int32 line, int32 column, String text)
|
||||||
{
|
{
|
||||||
QueueLine(gApp.GetEditData(fileName, true, false), line, column, text);
|
using (mMonitor.Enter())
|
||||||
|
{
|
||||||
|
QueuedEntry entry = new .();
|
||||||
|
entry.mFileName = new .(fileName);
|
||||||
|
entry.mLine = line;
|
||||||
|
entry.mColumn = column;
|
||||||
|
entry.mText = new .(text);
|
||||||
|
mQueuedEntries.Add(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
|
@ -620,6 +638,13 @@ namespace IDE.ui
|
||||||
|
|
||||||
using (mMonitor.Enter())
|
using (mMonitor.Enter())
|
||||||
{
|
{
|
||||||
|
while (!mQueuedEntries.IsEmpty)
|
||||||
|
{
|
||||||
|
var entry = mQueuedEntries.PopFront();
|
||||||
|
QueueLine(gApp.GetEditData(entry.mFileName, true, false), entry.mLine, entry.mColumn, entry.mText);
|
||||||
|
delete entry;
|
||||||
|
}
|
||||||
|
|
||||||
if (mPendingLines.Count > 0)
|
if (mPendingLines.Count > 0)
|
||||||
{
|
{
|
||||||
String sb = scope String();
|
String sb = scope String();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue