summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/host/video_frame_capturer_win.cc16
-rw-r--r--tools/valgrind/drmemory/suppressions.txt9
2 files changed, 10 insertions, 15 deletions
diff --git a/remoting/host/video_frame_capturer_win.cc b/remoting/host/video_frame_capturer_win.cc
index 3386c11..cfa0836 100644
--- a/remoting/host/video_frame_capturer_win.cc
+++ b/remoting/host/video_frame_capturer_win.cc
@@ -103,15 +103,15 @@ class VideoFrameCapturerWin : public VideoFrameCapturer {
scoped_array<uint8> last_cursor_;
SkISize last_cursor_size_;
- // Queue of the frames buffers.
- VideoFrameQueue queue_;
-
ScopedThreadDesktop desktop_;
// GDI resources used for screen capture.
scoped_ptr<base::win::ScopedGetDC> desktop_dc_;
base::win::ScopedCreateDC memory_dc_;
+ // Queue of the frames buffers.
+ VideoFrameQueue queue_;
+
// Rectangle describing the bounds of the desktop device context.
SkIRect desktop_dc_rect_;
@@ -348,14 +348,18 @@ void VideoFrameCapturerWin::CaptureImage() {
// Select the target bitmap into the memory dc and copy the rect from desktop
// to memory.
- VideoFrameWin* current =
- static_cast<VideoFrameWin*>(queue_.current_frame());
- if (SelectObject(memory_dc_, current->GetBitmap()) != NULL) {
+ VideoFrameWin* current = static_cast<VideoFrameWin*>(queue_.current_frame());
+ HGDIOBJ previous_object = SelectObject(memory_dc_, current->GetBitmap());
+ if (previous_object != NULL) {
BitBlt(memory_dc_,
0, 0, desktop_dc_rect_.width(), desktop_dc_rect_.height(),
*desktop_dc_,
desktop_dc_rect_.x(), desktop_dc_rect_.y(),
SRCCOPY | CAPTUREBLT);
+
+ // Select back the previously selected object to that the device contect
+ // could be destroyed independently of the bitmap if needed.
+ SelectObject(memory_dc_, previous_object);
}
}
diff --git a/tools/valgrind/drmemory/suppressions.txt b/tools/valgrind/drmemory/suppressions.txt
index bf23272..dc11b73 100644
--- a/tools/valgrind/drmemory/suppressions.txt
+++ b/tools/valgrind/drmemory/suppressions.txt
@@ -390,12 +390,3 @@ content.dll!*
KERNEL32.dll!*
ntdll.dll!*
ntdll.dll!*
-
-GDI USAGE ERROR
-name=http://crbug.com/160477
-system call NtGdiDeleteObjectApp
-GDI32.dll!DeleteDC
-*!base::win::CreateDCTraits::CloseHandle
-*!base::win::GenericScopedHandle<base::win::CreateDCTraits,base::win::VerifierTraits>::Close
-*!base::win::GenericScopedHandle<base::win::CreateDCTraits,base::win::VerifierTraits>::~GenericScopedHandle<base::win::CreateDCTraits,base::win::VerifierTraits>
-*!remoting::`anonymous namespace'::VideoFrameCapturerWin::~VideoFrameCapturerWin