From ecb10fa1d0b06ba322e0782a1becb67730f69707 Mon Sep 17 00:00:00 2001 From: "hashimoto@chromium.org" Date: Wed, 27 Nov 2013 08:23:31 +0000 Subject: Revert of https://codereview.chromium.org/71013004/ Reason for revert: Causing compile failure in chrome_util.cc on "Google Chrome Win" http://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20Win/builds/21803 TBR=cpu@chromium.org,jvoung@chromium.org,thakis@chromium.org,sergeyu@chromium.org,grt@chromium.org,gene@chromium.org,youngki@chromium.org,rvargas@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/90963002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237541 0039d316-1c4b-4281-b951-d872f2087c98 --- printing/backend/win_helper.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'printing') diff --git a/printing/backend/win_helper.h b/printing/backend/win_helper.h index db66bf8..0f6b7ef 100644 --- a/printing/backend/win_helper.h +++ b/printing/backend/win_helper.h @@ -46,10 +46,9 @@ class ScopedPrinterHandle base::win::VerifierTraits> { public: bool OpenPrinter(const wchar_t* printer) { - HANDLE temp_handle; // ::OpenPrinter may return error but assign some value into handle. - if (::OpenPrinter(const_cast(printer), &temp_handle, NULL)) { - Set(temp_handle); + if (!::OpenPrinter(const_cast(printer), Receive(), NULL)) { + Take(); } return IsValid(); } @@ -57,6 +56,10 @@ class ScopedPrinterHandle private: typedef base::win::GenericScopedHandle Base; + // Hide Receive to avoid assigning handle when ::OpenPrinter returned error. + Base::Receiver Receive() { + return Base::Receive(); + } }; class PrinterChangeHandleTraits { -- cgit v1.1