mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Gave all Threads a name, which simplifies debugging. Also fixed a problem with the Destination Picker, not closing the menu until something is clicked, this solves the problem with Disposing the surface!
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1613 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
27d28efbeb
commit
299a4fba72
10 changed files with 37 additions and 25 deletions
|
@ -67,11 +67,10 @@ namespace Greenshot.Destinations {
|
||||||
|
|
||||||
public override bool ExportCapture(ISurface surface, ICaptureDetails captureDetails) {
|
public override bool ExportCapture(ISurface surface, ICaptureDetails captureDetails) {
|
||||||
ContextMenuStrip menu = new ContextMenuStrip();
|
ContextMenuStrip menu = new ContextMenuStrip();
|
||||||
menu.Closed += delegate(object source, ToolStripDropDownClosedEventArgs eventArgs) {
|
menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {
|
||||||
// Dispose surface when no item was clicked, else the dispose should be made there!
|
LOG.DebugFormat("Close reason: {0}", eventArgs.CloseReason);
|
||||||
if (eventArgs.CloseReason != ToolStripDropDownCloseReason.ItemClicked) {
|
if (eventArgs.CloseReason != ToolStripDropDownCloseReason.ItemClicked && eventArgs.CloseReason != ToolStripDropDownCloseReason.CloseCalled) {
|
||||||
LOG.DebugFormat("Disposing as no item was clicked, reason: {0}", eventArgs.CloseReason);
|
eventArgs.Cancel = true;
|
||||||
surface.Dispose();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -83,7 +82,8 @@ namespace Greenshot.Destinations {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Fix foreach loop variable for the delegate
|
// Fix foreach loop variable for the delegate
|
||||||
ToolStripMenuItem item = destination.GetMenuItem(delegate(object sender, EventArgs e) {
|
ToolStripMenuItem item = destination.GetMenuItem(
|
||||||
|
delegate(object sender, EventArgs e) {
|
||||||
ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
|
ToolStripMenuItem toolStripMenuItem = sender as ToolStripMenuItem;
|
||||||
if (toolStripMenuItem == null) {
|
if (toolStripMenuItem == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -101,7 +101,8 @@ namespace Greenshot.Destinations {
|
||||||
}
|
}
|
||||||
// Make sure the menu is closed
|
// Make sure the menu is closed
|
||||||
menu.Close();
|
menu.Close();
|
||||||
});
|
}
|
||||||
|
);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
menu.Items.Add(item);
|
menu.Items.Add(item);
|
||||||
}
|
}
|
||||||
|
@ -112,6 +113,7 @@ namespace Greenshot.Destinations {
|
||||||
closeItem.Click += delegate {
|
closeItem.Click += delegate {
|
||||||
// This menu entry is the close itself, we can dispose the surface
|
// This menu entry is the close itself, we can dispose the surface
|
||||||
menu.Close();
|
menu.Close();
|
||||||
|
// Dispose as the close is clicked
|
||||||
surface.Dispose();
|
surface.Dispose();
|
||||||
};
|
};
|
||||||
menu.Items.Add(closeItem);
|
menu.Items.Add(closeItem);
|
||||||
|
|
|
@ -1111,6 +1111,7 @@ namespace Greenshot {
|
||||||
LOG.Debug("BackgroundWorkerTimerTick checking for update");
|
LOG.Debug("BackgroundWorkerTimerTick checking for update");
|
||||||
// Start update check in the background
|
// Start update check in the background
|
||||||
Thread backgroundTask = new Thread (new ThreadStart(UpdateHelper.CheckAndAskForUpdate));
|
Thread backgroundTask = new Thread (new ThreadStart(UpdateHelper.CheckAndAskForUpdate));
|
||||||
|
backgroundTask.Name = "Update check";
|
||||||
backgroundTask.IsBackground = true;
|
backgroundTask.IsBackground = true;
|
||||||
backgroundTask.Start();
|
backgroundTask.Start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -351,6 +351,7 @@ namespace Greenshot.Helpers {
|
||||||
windows = WindowDetails.SortByZOrder(IntPtr.Zero, windows);
|
windows = WindowDetails.SortByZOrder(IntPtr.Zero, windows);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
getWindowDetailsThread.Name = "Retrieve window details";
|
||||||
getWindowDetailsThread.IsBackground = true;
|
getWindowDetailsThread.IsBackground = true;
|
||||||
getWindowDetailsThread.Start();
|
getWindowDetailsThread.Start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ namespace Greenshot.Helpers {
|
||||||
// Create the mail message in an STA thread
|
// Create the mail message in an STA thread
|
||||||
Thread t = new Thread(new ThreadStart(_ShowMail));
|
Thread t = new Thread(new ThreadStart(_ShowMail));
|
||||||
t.IsBackground = true;
|
t.IsBackground = true;
|
||||||
t.Name = Application.ProductName;
|
t.Name = "Create MAPI mail";
|
||||||
t.SetApartmentState(ApartmentState.STA);
|
t.SetApartmentState(ApartmentState.STA);
|
||||||
t.Start();
|
t.Start();
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ namespace Greenshot.Helpers {
|
||||||
// Start update check in the background
|
// Start update check in the background
|
||||||
backgroundTask = new Thread (new ThreadStart(CaptureFrame));
|
backgroundTask = new Thread (new ThreadStart(CaptureFrame));
|
||||||
backgroundTask.IsBackground = true;
|
backgroundTask.IsBackground = true;
|
||||||
|
backgroundTask.Name = "Capture video";
|
||||||
backgroundTask.Start();
|
backgroundTask.Start();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,6 +25,7 @@ using System.Windows.Forms;
|
||||||
using GreenshotConfluencePlugin;
|
using GreenshotConfluencePlugin;
|
||||||
using GreenshotPlugin.Core;
|
using GreenshotPlugin.Core;
|
||||||
using IniFile;
|
using IniFile;
|
||||||
|
using GreenshotConfluencePlugin.confluence;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For details see the Confluence API site
|
/// For details see the Confluence API site
|
||||||
|
|
|
@ -97,6 +97,7 @@ namespace ExternalCommand {
|
||||||
Thread commandThread = new Thread (delegate() {
|
Thread commandThread = new Thread (delegate() {
|
||||||
CallExternalCommand(presetCommand, fullPath);
|
CallExternalCommand(presetCommand, fullPath);
|
||||||
});
|
});
|
||||||
|
commandThread.Name = "Running " + presetCommand;
|
||||||
commandThread.IsBackground = true;
|
commandThread.IsBackground = true;
|
||||||
commandThread.Start();
|
commandThread.Start();
|
||||||
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, host.CoreLanguage.GetFormattedString("exported_to", Description));
|
surface.SendMessageEvent(this, SurfaceMessageTyp.Info, host.CoreLanguage.GetFormattedString("exported_to", Description));
|
||||||
|
|
|
@ -97,6 +97,7 @@ namespace GreenshotImgurPlugin {
|
||||||
|
|
||||||
// retrieve history in the background
|
// retrieve history in the background
|
||||||
Thread backgroundTask = new Thread (new ThreadStart(CheckHistory));
|
Thread backgroundTask = new Thread (new ThreadStart(CheckHistory));
|
||||||
|
backgroundTask.Name = "Imgur History";
|
||||||
backgroundTask.IsBackground = true;
|
backgroundTask.IsBackground = true;
|
||||||
backgroundTask.SetApartmentState(ApartmentState.STA);
|
backgroundTask.SetApartmentState(ApartmentState.STA);
|
||||||
backgroundTask.Start();
|
backgroundTask.Start();
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace GreenshotNetworkImportPlugin {
|
||||||
}
|
}
|
||||||
public void StartListening() {
|
public void StartListening() {
|
||||||
Thread serverThread = new Thread(Listen);
|
Thread serverThread = new Thread(Listen);
|
||||||
|
serverThread.Name = "HTTP Receiver";
|
||||||
serverThread.SetApartmentState(ApartmentState.STA);
|
serverThread.SetApartmentState(ApartmentState.STA);
|
||||||
serverThread.Start();
|
serverThread.Start();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +93,9 @@ namespace GreenshotNetworkImportPlugin {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
HttpListenerContext context = listener.EndGetContext(result);
|
HttpListenerContext context = listener.EndGetContext(result);
|
||||||
new Thread(ProcessRequest).Start(context);
|
Thread requestThread = new Thread(ProcessRequest);
|
||||||
|
requestThread.Name = "Process Request";
|
||||||
|
requestThread.Start(context);
|
||||||
} catch (HttpListenerException httpE) {
|
} catch (HttpListenerException httpE) {
|
||||||
LOG.Error(httpE);
|
LOG.Error(httpE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace GreenshotPlugin.Controls {
|
||||||
BackgroundForm backgroundForm = new BackgroundForm(title, text);
|
BackgroundForm backgroundForm = new BackgroundForm(title, text);
|
||||||
// Show form in background thread
|
// Show form in background thread
|
||||||
Thread backgroundTask = new Thread (new ThreadStart(backgroundForm.BackgroundShowDialog));
|
Thread backgroundTask = new Thread (new ThreadStart(backgroundForm.BackgroundShowDialog));
|
||||||
|
backgroundForm.Name = "Background form";
|
||||||
backgroundTask.IsBackground = true;
|
backgroundTask.IsBackground = true;
|
||||||
backgroundTask.SetApartmentState(ApartmentState.STA);
|
backgroundTask.SetApartmentState(ApartmentState.STA);
|
||||||
backgroundTask.Start();
|
backgroundTask.Start();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue