[PATCH] move reference counting out of the UseHWCursor/UseHWCursorARGB functions

Roland Scheidegger rscheidegger_lists at hispeed.ch
Tue Mar 9 09:38:23 PST 2010

The problem is that the xf86_use_hw_cursor(_argb) functions may get this
correctly now, some drivers will replace this with their own functions.
It is pretty insane to expect them to do reference counting of the
cursor (as an example, look at driver/xf86-video-vmware to see how that
looks like as a workaround). There are even places in xserver itself
which replace these two functions.

FWIW, the segfaults are caused because the reference count of the cursor
reached zero, hence the cursor was freed, however
xf86CursorEnableDisableFBAccess() brought it back to life from the dead
(from the SavedCursor), at this point obviously anything can happen.
This patch hence adds reference counting in xf86CursorSetCursor.
In theory with this it should be possible to remove the reference
counting in the UseHwCursor functions I think, though it should also be
safe to keep them.
I can't guarantee though this is fully correct as the reference counting
looks a bit fishy overall, hopefully it won't create a memleak...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xserver_cursor_refcount.diff
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100309/1aa9f318/attachment.bin>

More information about the xorg-devel mailing list