Author: ekohl
Date: Fri Dec 26 14:06:19 2014
New Revision: 65837

URL: http://svn.reactos.org/svn/reactos?rev=65837&view=rev
Log:
[NOTEPAD]
Fix check mark of the status bar menu item.
Fix is based on mudheads patch.
CORE-8297 #resolve

Modified:
    trunk/reactos/base/applications/notepad/dialog.c

Modified: trunk/reactos/base/applications/notepad/dialog.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/notepad/dialog.c?rev=65837&r1=65836&r2=65837&view=diff
==============================================================================
--- trunk/reactos/base/applications/notepad/dialog.c    [iso-8859-1] (original)
+++ trunk/reactos/base/applications/notepad/dialog.c    [iso-8859-1] Fri Dec 26 
14:06:19 2014
@@ -557,7 +557,11 @@
     /* Let commdlg manage copy settings */
     printer.nCopies               = (WORD)PD_USEDEVMODECOPIES;
 
-    if (!PrintDlg(&printer)) return;
+    if (!PrintDlg(&printer))
+    {
+        DeleteObject(font);
+        return;
+    }
 
     assert(printer.hDC != 0);
 
@@ -568,7 +572,11 @@
     di.lpszDatatype = NULL;
     di.fwType = 0;
 
-    if (StartDoc(printer.hDC, &di) <= 0) return;
+    if (StartDoc(printer.hDC, &di) <= 0)
+    {
+        DeleteObject(font);
+        return;
+    }
 
     /* Get the page dimensions in pixels. */
     cWidthPels = GetDeviceCaps(printer.hDC, HORZRES);
@@ -579,6 +587,8 @@
     pTemp = HeapAlloc(GetProcessHeap(), 0, size * sizeof(TCHAR));
     if (!pTemp)
     {
+        EndDoc(printer.hDC);
+        DeleteObject(font);
         ShowLastError();
         return;
     }
@@ -605,6 +615,11 @@
                 if (StartPage(printer.hDC) <= 0) {
                     static const TCHAR failed[] = _T("StartPage failed");
                     static const TCHAR error[] = _T("Print Error");
+                    SelectObject(printer.hDC, old_font);
+                    EndDoc(printer.hDC);
+                    DeleteDC(printer.hDC);
+                    HeapFree(GetProcessHeap(), 0, pTemp);
+                    DeleteObject(font);
                     MessageBox(Globals.hMainWnd, failed, error, 
MB_ICONEXCLAMATION);
                     return;
                 }
@@ -644,9 +659,12 @@
         } while (i<size);
     }
 
+    if (old_font != 0)
+        SelectObject(printer.hDC, old_font);
     EndDoc(printer.hDC);
     DeleteDC(printer.hDC);
     HeapFree(GetProcessHeap(), 0, pTemp);
+    DeleteObject(font);
 }
 
 VOID DIALOG_FilePrinterSetup(VOID)
@@ -743,7 +761,7 @@
         SendMessage(Globals.hStatusBar, SB_SIMPLE, (WPARAM)TRUE, (LPARAM)0);
     }
 
-    // Set status bar visible or not accordind the the settings.
+    // Set status bar visiblity according to the settings.
     if (Globals.bWrapLongLines == TRUE ||
         Globals.bShowStatusBar == FALSE)
     {
@@ -758,7 +776,7 @@
     }
 
     // Set check state in show status bar item.
-    if (Globals.bShowStatusBar == TRUE)
+    if (bStatusBarVisible)
     {
         CheckMenuItem(Globals.hMenu, CMD_STATUSBAR, MF_BYCOMMAND | MF_CHECKED);
     }


Reply via email to