diff options
author | Alon Levy <alevy@redhat.com> | 2012-05-29 17:24:50 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2012-05-31 20:24:33 +0300 |
commit | c51ce46fe958b509121e7ec7eefac7e43b42e990 (patch) | |
tree | 12044b843f01d0a3b03c923851bbfa55c9fc8dbb | |
parent | be873ed21e43c10bee0576984a117c2433777154 (diff) |
fix two segfaults in qxl_free_surface
Both results from ProcFreePixmap being called in unanticipated
circumstances:
cache->all_surfaces is NULL
surface->host_image is NULL
To reproduce the following scripts work, in tandem:
create xterms, destroy them
chvt
============ xterm_test ============
import os
import subprocess
import time
import atexit
env = os.environ
env['DISPLAY'] = ':0.0'
xterms = []
def kill_all():
print "killing xterms"
for x in xterms:
x.kill()
del xterms[:]
atexit.register(kill_all)
while True:
for i in range(10):
xterms.append(subprocess.Popen(['xterm', '+u8']))
time.sleep(1)
kill_all()
============= chvt_test_helper ============
XPID=`pgrep Xorg`
XTTY=`find /proc/$XPID/fd -lname "/dev/tty*"`
XTTY=`readlink $XTTY`
XTTY=${XTTY#/dev/tty}
echo "chvt 1 (from Xorg)"
chvt 1
sleep 2
echo "chvt $XTTY (to Xorg)"
chvt $XTTY
============== chvt_test =================
while true; do ./chvt-test ; sleep 3; done
-rw-r--r-- | src/qxl_surface.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qxl_surface.c b/src/qxl_surface.c index f3a75fa..cce1743 100644 --- a/src/qxl_surface.c +++ b/src/qxl_surface.c @@ -868,7 +868,12 @@ qxl_surface_kill (qxl_surface_t *surface) unlink_surface (surface); + if (!surface->cache->all_surfaces) { + return; + } + if (surface->id != 0 && + surface->host_image && pixman_image_get_width (surface->host_image) >= 128 && pixman_image_get_height (surface->host_image) >= 128) { |