Browse Source

fixed threading bug in QueryCompiler

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3941 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
2e8f6fdd4d
  1. 24
      src/AddIns/Misc/Profiler/Controller/Queries/QueryCompiler.cs
  2. 3
      src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs

24
src/AddIns/Misc/Profiler/Controller/Queries/QueryCompiler.cs

@ -76,17 +76,19 @@ namespace ICSharpCode.Profiler.Controller.Queries @@ -76,17 +76,19 @@ namespace ICSharpCode.Profiler.Controller.Queries
if (string.IsNullOrEmpty(this.currentQuery))
return false;
if (!queryCache.ContainsKey(this.currentQuery)) {
string code = text + PreprocessString(currentQuery) + textEnd;
CompilerResults results = csc.CompileAssemblyFromSource(GetParameters(), code);
report(results.Errors.Cast<CompilerError>());
if (results.Errors.Count > 0)
return false;
queryCache.Add(this.currentQuery, results.CompiledAssembly);
} else {
report(new List<CompilerError>().AsEnumerable()); // clear errors list
lock (queryCache) {
if (!queryCache.ContainsKey(this.currentQuery)) {
string code = text + PreprocessString(currentQuery) + textEnd;
CompilerResults results = csc.CompileAssemblyFromSource(GetParameters(), code);
report(results.Errors.Cast<CompilerError>());
if (results.Errors.Count > 0)
return false;
queryCache.Add(this.currentQuery, results.CompiledAssembly);
} else {
report(new List<CompilerError>().AsEnumerable()); // clear errors list
}
}
return true;

3
src/AddIns/Misc/Profiler/Frontend/Controls/QueryView.xaml.cs

@ -148,9 +148,10 @@ namespace ICSharpCode.Profiler.Controls @@ -148,9 +148,10 @@ namespace ICSharpCode.Profiler.Controls
layer.Add(ad);
int rangeStart = RangeStart;
int rangeEnd = RangeEnd;
string query = this.CurrentQuery;
ProfilingDataProvider provider = Provider;
QueryCompiler compiler = new QueryCompiler(Reporter, this.CurrentQuery);
QueryCompiler compiler = new QueryCompiler(Reporter, query);
ringDiagram.SelectedRoot = null;
task.Execute(() => LoadWorker(provider, compiler, rangeStart, rangeEnd),

Loading…
Cancel
Save