mirror of
https://github.com/greenshot/greenshot
synced 2025-07-13 16:43:54 -07:00
Added SafeHandles, see here: http://blogs.msdn.com/b/bclteam/archive/2005/03/15/396335.aspx to some of the Greenshot code. Not all possible handles have been converted, this should be done to prevent more possible memory/resource leaks.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2427 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
e07278bc04
commit
502abed36a
5 changed files with 87 additions and 42 deletions
|
@ -627,7 +627,11 @@ namespace GreenshotPlugin.Core {
|
|||
return User32.IsIconic(this.hWnd) || Location.X <= -32000;
|
||||
}
|
||||
set {
|
||||
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
|
||||
if (value) {
|
||||
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
|
||||
} else {
|
||||
User32.SendMessage(this.hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -660,7 +664,7 @@ namespace GreenshotPlugin.Core {
|
|||
if (monitor != IntPtr.Zero) {
|
||||
if (appVisibility != null) {
|
||||
MONITOR_APP_VISIBILITY monitorAppVisibility = appVisibility.GetAppVisibilityOnMonitor(monitor);
|
||||
LOG.DebugFormat("App visible: {0}", monitorAppVisibility);
|
||||
LOG.DebugFormat("App {0} visible: {1} on {2}", Text, monitorAppVisibility, screen.Bounds);
|
||||
if (monitorAppVisibility == MONITOR_APP_VISIBILITY.MAV_APP_VISIBLE) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1097,6 +1101,7 @@ namespace GreenshotPlugin.Core {
|
|||
/// <returns>Bitmap with transparency</returns>
|
||||
private Bitmap ApplyTransparency(Bitmap blackBitmap, Bitmap whiteBitmap) {
|
||||
Bitmap returnBitmap = new Bitmap(blackBitmap.Width, blackBitmap.Height, PixelFormat.Format32bppArgb);
|
||||
returnBitmap.SetResolution(blackBitmap.HorizontalResolution, blackBitmap.VerticalResolution);
|
||||
using (BitmapBuffer blackBuffer = new BitmapBuffer(blackBitmap, false)) {
|
||||
blackBuffer.Lock();
|
||||
using (BitmapBuffer whiteBuffer = new BitmapBuffer(whiteBitmap, false)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue