Bug 785 : Threading problem with textFont
Last modified: 2008-05-31 09:12




Status:
RESOLVED
Resolution:
DUPLICATE of bug 726
Priority:
P2
Severity:
normal

 

Reporter:
ewjordan
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2008-05-30 17:53
The following sketch occasionally fails in 0137, on OS X 10.5.2 at least
(haven't checked Win/Lin):

PFont myFont;

void setup(){
size(640,480);
frameRate(30);
myFont = createFont("Courier",48);
textFont(myFont,14);
println("textFont in setup: "+g.textFont);
}

void draw(){
background(0);
fill(255);
println("textFont in draw: "+g.textFont);
text("Hello",5,15);
}



Roughly half the time I get the following output:

textFont in setup: processing.core.PFont@ab7165
textFont in draw: null

java.lang.RuntimeException: use textFont() before text()
(stack trace omitted)

The rest of the time the sketch runs fine, so this must be a threading
issue of some sort. Notice that the calls do happen in the right order,
but something resets textFont in between. I tried to poke around a bit,
but for some reason I can't get a build working on my Mac ("No such file or
directory at preproc.pl line 6." when I run.sh, and the app then works but
doesn't run sketches), so I couldn't track this down.
Additional Comment #1 From ewjordan 2008-05-30 17:58
Just noticed this is probably a dupe of
http://dev.processing.org/bugs/show_bug.cgi?id=726 - sorry about that,
should have checked first!
Additional Comment #2 From fry 2008-05-31 09:12
yeah, that's 726.. it's a high priority to get it fixed tho.

*** This bug has been marked as a duplicate of 726 ***