Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: cloud_print/virtual_driver/win/port_monitor/port_monitor.cc

Issue 413553002: Fixed MonitorData deletion in Monitor2Shutdown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cloud_print/virtual_driver/win/port_monitor/port_monitor.h" 5 #include "cloud_print/virtual_driver/win/port_monitor/port_monitor.h"
6 6
7 #include <lmcons.h> 7 #include <lmcons.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #include <strsafe.h> 10 #include <strsafe.h>
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 // this situation. 508 // this situation.
509 return TRUE; 509 return TRUE;
510 } 510 }
511 511
512 BOOL WINAPI Monitor2ClosePort(HANDLE port_handle) { 512 BOOL WINAPI Monitor2ClosePort(HANDLE port_handle) {
513 if (port_handle == NULL) { 513 if (port_handle == NULL) {
514 LOG(ERROR) << "port_handle should not be NULL."; 514 LOG(ERROR) << "port_handle should not be NULL.";
515 SetLastError(ERROR_INVALID_PARAMETER); 515 SetLastError(ERROR_INVALID_PARAMETER);
516 return FALSE; 516 return FALSE;
517 } 517 }
518 PortData* port_data = reinterpret_cast<PortData*>(port_handle); 518 delete reinterpret_cast<PortData*>(port_handle);
519 delete port_data;
520 return TRUE; 519 return TRUE;
521 } 520 }
522 521
523 VOID WINAPI Monitor2Shutdown(HANDLE monitor_handle) { 522 VOID WINAPI Monitor2Shutdown(HANDLE monitor_handle) {
524 if (monitor_handle != NULL) { 523 if (monitor_handle != NULL) {
525 MonitorData* monitor_data = 524 delete reinterpret_cast<MonitorData*>(monitor_handle);
526 reinterpret_cast<MonitorData*>(monitor_handle);
527 delete monitor_handle;
528 } 525 }
529 } 526 }
530 527
531 BOOL WINAPI Monitor2XcvOpenPort(HANDLE, 528 BOOL WINAPI Monitor2XcvOpenPort(HANDLE,
532 const wchar_t*, 529 const wchar_t*,
533 ACCESS_MASK granted_access, 530 ACCESS_MASK granted_access,
534 HANDLE* handle) { 531 HANDLE* handle) {
535 if (handle == NULL) { 532 if (handle == NULL) {
536 LOG(ERROR) << "handle should not be NULL."; 533 LOG(ERROR) << "handle should not be NULL.";
537 SetLastError(ERROR_INVALID_PARAMETER); 534 SetLastError(ERROR_INVALID_PARAMETER);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 output_data_bytes, 571 output_data_bytes,
575 dll_path.value().c_str()); 572 dll_path.value().c_str());
576 } 573 }
577 } else { 574 } else {
578 return ERROR_INVALID_PARAMETER; 575 return ERROR_INVALID_PARAMETER;
579 } 576 }
580 return ret_val; 577 return ret_val;
581 } 578 }
582 579
583 BOOL WINAPI Monitor2XcvClosePort(HANDLE handle) { 580 BOOL WINAPI Monitor2XcvClosePort(HANDLE handle) {
584 XcvUiData* xcv_data = reinterpret_cast<XcvUiData*>(handle); 581 delete reinterpret_cast<XcvUiData*>(handle);
585 delete xcv_data;
586 return TRUE; 582 return TRUE;
587 } 583 }
588 584
589 BOOL WINAPI MonitorUiAddPortUi(const wchar_t*, 585 BOOL WINAPI MonitorUiAddPortUi(const wchar_t*,
590 HWND hwnd, 586 HWND hwnd,
591 const wchar_t* monitor_name, 587 const wchar_t* monitor_name,
592 wchar_t**) { 588 wchar_t**) {
593 HandlePortUi(hwnd, monitor_name); 589 HandlePortUi(hwnd, monitor_name);
594 return TRUE; 590 return TRUE;
595 } 591 }
(...skipping 21 matching lines...) Expand all
617 // Single spooler.exe handles verbose users. 613 // Single spooler.exe handles verbose users.
618 PathService::DisableCache(); 614 PathService::DisableCache();
619 } 615 }
620 return &cloud_print::g_monitor_2; 616 return &cloud_print::g_monitor_2;
621 } 617 }
622 618
623 MONITORUI* WINAPI InitializePrintMonitorUI(void) { 619 MONITORUI* WINAPI InitializePrintMonitorUI(void) {
624 return &cloud_print::g_monitor_ui; 620 return &cloud_print::g_monitor_ui;
625 } 621 }
626 622
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698