swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swarm-Support] In need of help : X error generated by call to[Pixma


From: Paul Johnson
Subject: Re: [Swarm-Support] In need of help : X error generated by call to[Pixmap setWidget:]
Date: Mon, 31 Aug 2009 14:41:52 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Thomas Louail wrote:
> Hello swarm people,
> 
> We develop a urban simulation model with swarm. The model simulates the 
> localisation of different kinds of socio-economical activities inside a 
> city's neighbourhoods. To observe how each socio-economical activity is 
> localized as a result of the model execution, we produce at each time 
> step for each type of activity a map (drawn in a zoomraster) of its 
> localisations. We want to export these raster images in files through 
> the use of swarm's Pixmap facilities, and the save method.
> 
If it does not happen on 2 computers, but everything is the same, then
it may be a hint you have some hardware problem on one of the systems.
That's assuming everything is actually the same, which I doubt.

I note You allocate rasterName with 100 characters.  I have seen a crash
like you describe if the file name becomes very long because it
overwrites the allocated space and "steps on" another object in memory.

I have not done this by repeatedly creating and destroying zoom rasters.
  I've always kept the same raster in place and drawn on it and saved
the state.  You could do that too to save some effort.

I think you could check this one for an example where I have an array of
rasters that are saved in the batch version:

http://pj.freefaculty.org/Swarm/MySwarmCode/OpinionFormation/Opinion-2.0.1.tar.gz

If I were you, I'd try to make this work just saving one raster--no for
loop--and after that works, then worry about saving a set of them.

pj


> Here is how i coded that (in ObserverSwarm.m) :
> 
> Below is the method responsible to create and to save these png files. 
> It's called at each timestep
>> - takeScreenShots
>> {
>> ...
>>
>> for (i=0; i<[modelSwarm getNumFunctions];i++)
>>     {
>>       ...
>>       id <ZoomRaster> raster = [ZoomRaster createBegin:self];
>>       SET_WINDOW_GEOMETRY_RECORD_NAME (raster);
>>       [raster createEnd];
>>      
>>       [raster setZoomFactor:1];
>>       [raster setWidth: [[modelSwarm getWorld] getSizeX]
>>           Height: [[modelSwarm getWorld] getSizeY]];
>>       [raster setColormap : functionColors]; // this colormap is a 
>> ObserverSwarm instance variable
>>      
>>       char rasterName [100];
>>      
>>       ...
>>       aPix =[Pixmap createBegin: self]; // Create the pixmap necessary
> 
>> to create
>>                      // a screenshot
>>
>>      sprintf(rasterName, "%s in %4d",
>>           [function getName],
>>           [modelSwarm getDate]);
>>      
>>       [raster setWindowTitle:rasterName];
>>       [raster pack];
>>      
>>       functionDisplay = [Value2dDisplay create: self
>>                     setDisplayWidget: raster
>>                     colormap: functionColors
>>                     setDiscrete2dToDisplay: gridOfQuartiersId];
>>      
>>       [raster erase];
>>       [functionDisplay display];
>>      
>>      
>>       [aPix setWidget: raster];
>>       [aPix setDecorationsFlag: YES];
>>       aPix= [aPix createEnd];        
>>      
>>       [aPix save: filename];
>>
>>       [aPix drop];
>>       [functionDisplay drop];
>>       [raster drop];
>>
>> } // enf of the loop on functions
>>
>> return self;
>> }
> 
> *At run time, the model runs fine until it reaches the call to [aPix 
> setWidget: raster], which generates a X error* :
> 
>> X Error of failed request:  BadWindow (invalid Window parameter)
>>   Major opcode of failed request:  15 (X_QueryTree)
>>   Resource id in failed request:  0x0
>>   Serial number of failed request:  445047
>>   Current serial number in output stream:  445047
> 
> GDB execution produces no stack (i'm not a GDB expert..)  :
> 
>> X Error of failed request:  BadWindow (invalid Window parameter)
>>   Major opcode of failed request:  15 (X_QueryTree)
>>   Resource id in failed request:  0x0
>>   Serial number of failed request:  194159
>>   Current serial number in output stream:  194159
>>
>> Program exited with code 01.
>> (gdb) bt
>> No stack.
>> (gdb)
> so it's difficult to trak down the error.
> 
> I work on an Ubuntu 8.4 workstation, and my swarm version is 2.2.4. The 
> funny thing is that i've test the same code on my laptop (which runs 
> swarm 2.2.4 on an ubuntu 8.04 too) and the same code does'nt generate 
> any error, and the png outputs are fine...
> 
> I'm a little bit lost right now... does any of you swarm members already
> 
> encounter X Error of the same kind ? I've browsed the archived support 
> mailing list but couldn't find any relevant topic for this problem.
> 
> Thanks in advance for your help,
> 
> Have a good day,
> 
> thomas
> 
> _______________________________________________
> Support mailing list
> address@hidden
> http://www.swarm.org/mailman/listinfo/support


-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://pj.freefaculty.org
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700


reply via email to

[Prev in Thread] Current Thread [Next in Thread]