summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-04-22 21:22:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-04-22 21:26:47 +0100
commitbb5b21e34f6cbe44a249e566471754b45c500e60 (patch)
tree4cc97e020389f390915632a81b80a8bcaa7c550c
parentb12bc035fb8ee40bb382e66604e869b729270189 (diff)
sna: Apply defense against a rogue call to move a SW cursor
So the sna_set_cursor_postion() assertion was reported to have caught us trying to adjust the position of an absent cursor. That should be impossible as we should only arrive there if we claim we can support a HW cursor and so have a registered cursor. However, changing the assertion into a guard is trivial, and preserves peace of mind. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_display.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index ab5b5298..84d572e8 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3460,8 +3460,10 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y)
struct sna *sna = to_sna(scrn);
int sigio, c;
- __DBG(("%s(%d, %d)\n", __FUNCTION__, x, y));
- assert(sna->cursor.ref);
+ __DBG(("%s(%d, %d), cursor? %d\n", __FUNCTION__,
+ x, y, sna->cursor.ref!=NULL));
+ if (sna->cursor.ref == NULL)
+ return;
sigio = sigio_block();
sna->cursor.last_x = x;
@@ -3685,9 +3687,6 @@ sna_cursors_init(ScreenPtr screen, struct sna *sna)
static void
sna_cursors_reload(struct sna *sna)
{
- if (sna->cursor.ref == NULL)
- return;
-
sna_set_cursor_position(sna->scrn,
sna->cursor.last_x,
sna->cursor.last_y);