Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix http://community.sharpdevelop.net/forums/t/11954.aspx - Cannot se…

…lect project resource as form icon: "This operation can be called on the main thread only"
  • Loading branch information...
commit eedd9ddba73134f69a9ad4c0382d168bfd7f4dc2 1 parent 1876bf4
@dgrunwald dgrunwald authored
View
15 src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/ImageResourceEditorDialog.cs
@@ -17,6 +17,7 @@
using ICSharpCode.FormsDesigner.Services;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
+using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.FormsDesigner.Gui
@@ -369,11 +370,15 @@ static TreeNode GetOrCreateDirectoryNode(TreeNode root, string directory)
Dictionary<string, object> GetResources(string fileName)
{
- Stream s;
- OpenedFile file = FileService.GetOpenedFile(fileName);
- if (file != null) {
- s = file.OpenRead();
- } else {
+ Stream s = null;
+ WorkbenchSingleton.SafeThreadCall(
+ delegate {
+ OpenedFile file = FileService.GetOpenedFile(fileName);
+ if (file != null) {
+ s = file.OpenRead();
+ }
+ });
+ if (s == null) {
s = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
}
using(s) {
Please sign in to comment.
Something went wrong with that request. Please try again.