diff options
Diffstat (limited to 'printing/backend/win_helper.h')
-rw-r--r-- | printing/backend/win_helper.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/printing/backend/win_helper.h b/printing/backend/win_helper.h index 0f6b7ef..db66bf8 100644 --- a/printing/backend/win_helper.h +++ b/printing/backend/win_helper.h @@ -46,9 +46,10 @@ 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<LPTSTR>(printer), Receive(), NULL)) { - Take(); + if (::OpenPrinter(const_cast<LPTSTR>(printer), &temp_handle, NULL)) { + Set(temp_handle); } return IsValid(); } @@ -56,10 +57,6 @@ class ScopedPrinterHandle private: typedef base::win::GenericScopedHandle<PrinterHandleTraits, base::win::VerifierTraits> Base; - // Hide Receive to avoid assigning handle when ::OpenPrinter returned error. - Base::Receiver Receive() { - return Base::Receive(); - } }; class PrinterChangeHandleTraits { |