The following code crashes the X server:
def knot3(m=3.0, l=4.0):
beginTrianglesEntity() ### begin (A)
x = 1.5
y = 0.0
z = 0.0
line_from(x, y, z) ### begin (B)
triangle(x, y, x+0.1, y, x+0.1, y+0.1) ### (A)
continues
for i in range(1, 1001):
mu = (i*2*pi*m)/1000.0
nu = (l*mu)/m
x = cos(mu) * (1 + (cos(nu) / 2.0))
y = sin(mu) * (1 + (cos(nu) / 2.0))
z = sin(nu) / 2.0
line_to(x, y, z) ### (B) continues
triangle(x, y, x+0.1, y, x, y+0.1, z, z, z) ###
(A) continues
This happens because of the way iMem::beginEntity and
the entity marshall interactuate; internally, these
functions are called:
iTriangles->beginEntity(layer); (set values a)
iPageStrip->beginEntity(layer); (set values b)
iPageStrip->pushPoint(x, y, z); (increase entities_count b)
iTriangles->pushPoint(x1, y1, z1); (increase
entities_count a)
In short, entities_count is increased twice, and the
address where iTriangles expects to found the bounding
boxes is where iPageStrip set them.
As a temporary workaround, don't add points to an
entity if it is not the one that was created le last.
For example, the crashing function above must be written:
def knot3(m=3.0, l=4.0):
x = 1.5
y = 0.0
z = 0.0
beginTrianglesEntity() # Begin an entity for a triangle
triangle(x, y, x+0.1, y, x+0.1, y+0.1) # draw the
triangle
for i in range(1, 1001):
mu = (i*2*pi*m)/1000.0
nu = (l*mu)/m
x = cos(mu) * (1 + (cos(nu) / 2.0))
y = sin(mu) * (1 + (cos(nu) / 2.0))
z = sin(nu) / 2.0
triangle(x, y, x+0.1, y, x, y+0.1, z, z, z) #
draw more triangles
x = 1.5
y = 0.0
z = 0.0
line_from(x, y, z) # begin an entity for line strips
for i in range(1, 1001):
mu = (i*2*pi*m)/1000.0
nu = (l*mu)/m
x = cos(mu) * (1 + (cos(nu) / 2.0))
y = sin(mu) * (1 + (cos(nu) / 2.0))
z = sin(nu) / 2.0
line_to(x, y, z) # Continue the line strips
Note that no line_to was called between
beginTrianglesEntity and triangle, and no triangle was
called between line_from and line_to.
I'm actively working on a fix.
Jaime Soffer
None
None
Public
|
Date: 2003-11-13 00:32 Logged In: YES |
|
Date: 2003-03-17 22:36 Logged In: YES |
| Field | Old Value | Date | By |
|---|---|---|---|
| status_id | Open | 2003-11-13 00:32 | j_soffer |
| close_date | - | 2003-11-13 00:32 | j_soffer |
| priority | 9 | 2003-03-17 22:36 | j_soffer |
| assigned_to | nobody | 2003-03-17 12:13 | j_soffer |
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use