mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Fixed thread issues with the Thread which retrieves the window details.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1635 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
6ae97acd99
commit
2b53b58442
1 changed files with 11 additions and 2 deletions
|
@ -52,6 +52,7 @@ namespace Greenshot.Helpers {
|
|||
private ICapture capture = null;
|
||||
private ILanguage lang = Language.GetInstance();
|
||||
private CaptureMode captureMode;
|
||||
private Thread windowDetailsThread = null;
|
||||
|
||||
public static void CaptureClipboard() {
|
||||
new CaptureHelper(CaptureMode.Clipboard).MakeCapture();
|
||||
|
@ -145,7 +146,7 @@ namespace Greenshot.Helpers {
|
|||
capture.CaptureDetails.CaptureMode = captureMode;
|
||||
|
||||
// Get the windows details in a seperate thread
|
||||
Thread getWindowDetailsThread = PrepareForCaptureWithFeedback();
|
||||
windowDetailsThread = PrepareForCaptureWithFeedback();
|
||||
|
||||
// Add destinations if no-one passed a handler
|
||||
if (capture.CaptureDetails.CaptureDestinations == null || capture.CaptureDetails.CaptureDestinations.Count == 0) {
|
||||
|
@ -276,6 +277,9 @@ namespace Greenshot.Helpers {
|
|||
case CaptureMode.LastRegion:
|
||||
if (!RuntimeConfig.LastCapturedRegion.IsEmpty) {
|
||||
capture = WindowCapture.CaptureScreen(capture);
|
||||
if (windowDetailsThread != null) {
|
||||
windowDetailsThread.Join();
|
||||
}
|
||||
capture.Crop(RuntimeConfig.LastCapturedRegion);
|
||||
capture.CaptureDetails.AddMetaData("source", "screen");
|
||||
HandleCapture();
|
||||
|
@ -297,7 +301,9 @@ namespace Greenshot.Helpers {
|
|||
LOG.Warn("Unknown capture mode: " + captureMode);
|
||||
break;
|
||||
}
|
||||
getWindowDetailsThread.Join();
|
||||
if (windowDetailsThread != null) {
|
||||
windowDetailsThread.Join();
|
||||
}
|
||||
if (capture != null) {
|
||||
LOG.Debug("Disposing capture");
|
||||
capture.Dispose();
|
||||
|
@ -733,6 +739,9 @@ namespace Greenshot.Helpers {
|
|||
}
|
||||
|
||||
if (captureRect.Height > 0 && captureRect.Width > 0) {
|
||||
if (windowDetailsThread != null) {
|
||||
windowDetailsThread.Join();
|
||||
}
|
||||
// Take the captureRect, this already is specified as bitmap coordinates
|
||||
capture.Crop(captureRect);
|
||||
// save for re-capturing later and show recapture context menu option
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue