swarm-support
[Top][All Lists]
Advanced

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

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


From: Thomas Louail
Subject: [Swarm-Support] In need of help : X error generated by call to [Pixmap setWidget:]
Date: Mon, 31 Aug 2009 19:59:24 +0200
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

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.

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



reply via email to

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