summaryrefslogtreecommitdiffstats
path: root/client/windows
diff options
context:
space:
mode:
authorIzik Eidus <ieidus@redhat.com>2010-04-09 05:06:32 +0300
committerIzik Eidus <ieidus@redhat.com>2010-04-09 05:09:02 +0300
commit22d1ac9eb5757ec5a51ec377d3ed31bf520f4ae0 (patch)
treefb901b561d6cafc01063368733c770a28342b49c /client/windows
parent187a4230e511e8f13bdf635307db5251405cc7f5 (diff)
downloadspice-22d1ac9eb5757ec5a51ec377d3ed31bf520f4ae0.tar.gz
spice-22d1ac9eb5757ec5a51ec377d3ed31bf520f4ae0.tar.xz
spice-22d1ac9eb5757ec5a51ec377d3ed31bf520f4ae0.zip
spice: win32 client: fix gdi locking
While the fix could have been more effective, it seems like this patch stream better with the coding logic that was there..., maybe later we will want to change the locking into more effective way. (There is just the primary surface to protect in reiality) Signed-off-by: Izik Eidus <ieidus@redhat.com>
Diffstat (limited to 'client/windows')
-rw-r--r--client/windows/pixels_source.cpp2
-rw-r--r--client/windows/pixels_source_p.h4
-rw-r--r--client/windows/red_drawable.cpp14
-rw-r--r--client/windows/red_pixmap_gdi.cpp2
4 files changed, 11 insertions, 11 deletions
diff --git a/client/windows/pixels_source.cpp b/client/windows/pixels_source.cpp
index 178b88fd..7b6fe813 100644
--- a/client/windows/pixels_source.cpp
+++ b/client/windows/pixels_source.cpp
@@ -41,7 +41,7 @@ PixelsSource::PixelsSource()
_origin.x = _origin.y = 0;
memset(_opaque, 0, sizeof(_opaque));
PixelsSource_p* p_data = (PixelsSource_p*)_opaque;
- p_data->_mutex = new Mutex();
+ p_data->_mutex = new RecurciveMutex();
}
PixelsSource::~PixelsSource()
diff --git a/client/windows/pixels_source_p.h b/client/windows/pixels_source_p.h
index eb646395..0f59f2d7 100644
--- a/client/windows/pixels_source_p.h
+++ b/client/windows/pixels_source_p.h
@@ -18,11 +18,11 @@
#ifndef _H_PIXELE_SOURSR_P
#define _H_PIXELE_SOURSR_P
-class Mutex;
+class RecurciveMutex;
struct PixelsSource_p {
HDC dc;
- Mutex* _mutex;
+ RecurciveMutex* _mutex;
};
#endif
diff --git a/client/windows/red_drawable.cpp b/client/windows/red_drawable.cpp
index cac7299e..bc01adec 100644
--- a/client/windows/red_drawable.cpp
+++ b/client/windows/red_drawable.cpp
@@ -51,8 +51,8 @@ void RedDrawable::blend_pixels(const PixelsSource& src, int src_x, int src_y, co
PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque();
PixelsSource_p* src_p_data = (PixelsSource_p*)src.get_opaque();
for (;;) {
- Lock lock(*dest_p_data->_mutex);
- Lock timed_lock(*src_p_data->_mutex, lock_timout);
+ RecurciveLock lock(*dest_p_data->_mutex);
+ RecurciveLock timed_lock(*src_p_data->_mutex, lock_timout);
if (!timed_lock.is_locked()) {
continue;
}
@@ -84,8 +84,8 @@ void RedDrawable::combine_pixels(const PixelsSource& src, int src_x, int src_y,
PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque();
PixelsSource_p* src_p_data = (PixelsSource_p*)src.get_opaque();
for (;;) {
- Lock lock(*dest_p_data->_mutex);
- Lock timed_lock(*src_p_data->_mutex, lock_timout);
+ RecurciveLock lock(*dest_p_data->_mutex);
+ RecurciveLock timed_lock(*src_p_data->_mutex, lock_timout);
if (!timed_lock.is_locked()) {
continue;
}
@@ -106,7 +106,7 @@ void RedDrawable::erase_rect(const SpiceRect& rect, rgb32_t color)
r.bottom = rect.bottom + _origin.y;
PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque();
- Lock lock(*dest_p_data->_mutex);
+ RecurciveLock lock(*dest_p_data->_mutex);
FillRect(dest_p_data->dc, &r, (HBRUSH)GetStockObject(BLACK_BRUSH));
}
@@ -123,7 +123,7 @@ void RedDrawable::fill_rect(const SpiceRect& rect, rgb32_t color)
rgb32_get_blue(color)));
for (;;) {
PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque();
- Lock lock(*dest_p_data->_mutex);
+ RecurciveLock lock(*dest_p_data->_mutex);
FillRect(dest_p_data->dc, &r, brush);
break;
}
@@ -142,7 +142,7 @@ void RedDrawable::frame_rect(const SpiceRect& rect, rgb32_t color)
rgb32_get_blue(color)));
for (;;) {
PixelsSource_p* dest_p_data = (PixelsSource_p*)get_opaque();
- Lock lock(*dest_p_data->_mutex);
+ RecurciveLock lock(*dest_p_data->_mutex);
FrameRect(dest_p_data->dc, &r, brush);
break;
}
diff --git a/client/windows/red_pixmap_gdi.cpp b/client/windows/red_pixmap_gdi.cpp
index adb21da8..860c90c0 100644
--- a/client/windows/red_pixmap_gdi.cpp
+++ b/client/windows/red_pixmap_gdi.cpp
@@ -94,7 +94,7 @@ RedPixmapGdi::~RedPixmapGdi()
}
}
-Mutex& RedPixmapGdi::get_mutex()
+RecurciveMutex& RedPixmapGdi::get_mutex()
{
RedPixmap_p* p_data = (RedPixmap_p*)get_opaque();
return *p_data->pixels_source_p._mutex;