diff options
author | Alon Levy <alevy@redhat.com> | 2012-05-29 17:24:50 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2012-06-27 14:41:30 +0300 |
commit | 4bcaba4203dfb079eaf9a01c3b0c997563e8c6a9 (patch) | |
tree | 1d7b5ddd583b9763738f348f13c4e18d82350454 | |
parent | 7adea18daf70f0094fb75ced92dafd8a731894b9 (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 e58a0d4..347503d 100644 --- a/src/qxl_surface.c +++ b/src/qxl_surface.c @@ -871,7 +871,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) { |