OSX_0.05_FAT: ofImage::allocate doesn't call update()

as per the title.

if i go like this:

  
	for ( int i=0; i<5; i++ )  
	{  
		frames[i].allocate( frame_width, frame_height, OF_IMAGE_COLOR );  
		printf("%d: %x\n", i, frames[i].getPixels());  
	}  
  

i get output like this:

  
  
0: 64c460  
1: 6589b0  
2: 65cd60  
3: 65de30  
4: 646ed0  
5: a1b1c1d3  
6: a1b1c1d3  
7: a1b1c1d3  
8: 65a1a0  
9: 65e610  
10: 64e9c0  
11: 0  
12: 0  
...  
  

which looks broken. then when i call getPixels() it crashes with signal EXC_BAD_ACCESS.

inserting a call to update() at the end of allocate() gives the much more reasonable output:

  
  
0: 15729000  
1: 15836000  
2: 15943000  
3: 15a50000  
4: 15b5d000  
5: 15c6a000  
6: 15d37000  
...  

and better still, it doesn’t crash!

:slight_smile:

  • damian

hi damian –

that looks like a bug and a reasonable fix. Update() gets called whenever the internal info of the ofImage is changes, and makes sense to be called at the end of allocate. thanks!

take care,
zach