mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 21:43:24 -07:00
Fixed NullReferenzException
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1615 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
d4e9b70161
commit
23e9843d07
1 changed files with 8 additions and 4 deletions
|
@ -145,7 +145,7 @@ namespace Greenshot.Helpers {
|
||||||
capture.CaptureDetails.CaptureMode = captureMode;
|
capture.CaptureDetails.CaptureMode = captureMode;
|
||||||
|
|
||||||
// Get the windows details in a seperate thread
|
// Get the windows details in a seperate thread
|
||||||
PrepareForCaptureWithFeedback();
|
Thread getWindowDetailsThread = PrepareForCaptureWithFeedback();
|
||||||
|
|
||||||
// Add destinations if no-one passed a handler
|
// Add destinations if no-one passed a handler
|
||||||
if (capture.CaptureDetails.CaptureDestinations == null || capture.CaptureDetails.CaptureDestinations.Count == 0) {
|
if (capture.CaptureDetails.CaptureDestinations == null || capture.CaptureDetails.CaptureDestinations.Count == 0) {
|
||||||
|
@ -297,7 +297,7 @@ namespace Greenshot.Helpers {
|
||||||
LOG.Warn("Unknown capture mode: " + captureMode);
|
LOG.Warn("Unknown capture mode: " + captureMode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
getWindowDetailsThread.Join();
|
||||||
if (capture != null) {
|
if (capture != null) {
|
||||||
LOG.Debug("Disposing capture");
|
LOG.Debug("Disposing capture");
|
||||||
capture.Dispose();
|
capture.Dispose();
|
||||||
|
@ -307,10 +307,10 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pre-Initialization for CaptureWithFeedback, this will get all the windows before we change anything
|
/// Pre-Initialization for CaptureWithFeedback, this will get all the windows before we change anything
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void PrepareForCaptureWithFeedback() {
|
private Thread PrepareForCaptureWithFeedback() {
|
||||||
windows = new List<WindowDetails>();
|
windows = new List<WindowDetails>();
|
||||||
|
|
||||||
Thread getWindowDetailsThread= new Thread (delegate() {
|
Thread getWindowDetailsThread = new Thread (delegate() {
|
||||||
// Start Enumeration of "active" windows
|
// Start Enumeration of "active" windows
|
||||||
foreach (WindowDetails window in WindowDetails.GetAllWindows()) {
|
foreach (WindowDetails window in WindowDetails.GetAllWindows()) {
|
||||||
// Window should be visible and not ourselves
|
// Window should be visible and not ourselves
|
||||||
|
@ -340,6 +340,9 @@ namespace Greenshot.Helpers {
|
||||||
|
|
||||||
// Get window rectangle as capture Element
|
// Get window rectangle as capture Element
|
||||||
CaptureElement windowCaptureElement = new CaptureElement(windowRectangle);
|
CaptureElement windowCaptureElement = new CaptureElement(windowRectangle);
|
||||||
|
if (capture == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
capture.Elements.Add(windowCaptureElement);
|
capture.Elements.Add(windowCaptureElement);
|
||||||
|
|
||||||
if (!window.HasParent) {
|
if (!window.HasParent) {
|
||||||
|
@ -359,6 +362,7 @@ namespace Greenshot.Helpers {
|
||||||
getWindowDetailsThread.Name = "Retrieve window details";
|
getWindowDetailsThread.Name = "Retrieve window details";
|
||||||
getWindowDetailsThread.IsBackground = true;
|
getWindowDetailsThread.IsBackground = true;
|
||||||
getWindowDetailsThread.Start();
|
getWindowDetailsThread.Start();
|
||||||
|
return getWindowDetailsThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCaptureElementsForWindow(ICaptureElement parentElement, WindowDetails parentWindow, int level) {
|
private void AddCaptureElementsForWindow(ICaptureElement parentElement, WindowDetails parentWindow, int level) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue