[Spice-devel] [PATCH 09/15] worker: don't process drawable if it can't be allocated
Frediano Ziglio
fziglio at redhat.com
Wed Nov 4 07:48:45 PST 2015
This patch does the same of former one.
[PATCH] worker: don't process drawable if it can't be allocated
---
server/red_worker.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/server/red_worker.c b/server/red_worker.c
index 5b1ece8..5005e7c 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -3211,14 +3211,14 @@ static inline int red_handle_self_bitmap(RedWorker *worker, Drawable *drawable)
return TRUE;
}
-static void free_one_drawable(RedWorker *worker, int force_glz_free)
+static bool free_one_drawable(RedWorker *worker, int force_glz_free)
{
RingItem *ring_item = ring_get_tail(&worker->current_list);
Drawable *drawable;
Container *container;
if (!ring_item) {
- return;
+ return FALSE;
}
drawable = SPICE_CONTAINEROF(ring_item, Drawable, list_link);
if (force_glz_free) {
@@ -3233,6 +3233,8 @@ static void free_one_drawable(RedWorker *worker, int force_glz_free)
current_remove_drawable(worker, drawable);
container_cleanup(worker, container);
+
+ return TRUE;
}
static Drawable *get_drawable(RedWorker *worker, uint8_t effect, RedDrawable *red_drawable,
@@ -3253,7 +3255,8 @@ static Drawable *get_drawable(RedWorker *worker, uint8_t effect, RedDrawable *re
}
while (!(drawable = alloc_drawable(worker))) {
- free_one_drawable(worker, FALSE);
+ if (!free_one_drawable(worker, FALSE))
+ return NULL;
}
worker->drawable_count++;
memset(drawable, 0, sizeof(Drawable));
@@ -3356,7 +3359,6 @@ static inline void red_process_draw(RedWorker *worker, RedDrawable *red_drawable
Drawable *drawable = get_drawable(worker, red_drawable->effect, red_drawable, group_id);
if (!drawable) {
- rendering_incorrect("failed to get_drawable");
return;
}
--
2.4.3
More information about the Spice-devel
mailing list