Crystal Space
Welcome, Guest. Please login or register.
July 23, 2014, 11:13:47 am

Login with username, password and session length
Search:     Advanced search
9005 Posts in 2043 Topics by 8220 Members
Latest Member: Igymatta
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Problem with PcZoneManager::PointMesh()
« previous next »
Pages: [1] Print
Author Topic: Problem with PcZoneManager::PointMesh()  (Read 1413 times)
Newbie
*
Posts: 8


View Profile Email
« on: November 09, 2007, 04:44:44 am »

Dear CrystalSpace3D fellows;
  I cannot successfully place a mesh into a celRegion, and in turn, a csRegion, using the PcZoneManager's PointMesh() function. I have a world class that has an entity which holds a Zone Manager property class. It's PointMesh() function cannot find the entity, region and start position using the names that I give to it. It keeps on having trouble when using string manipulation functions to examine the names I passed to it. I am using a debugger to see this. It has visible trouble during the string manipulation function, Replace(), that I believe is being called on each of the names that I passed to the function: the entity name, the region name and the start position name. The Replace() function leads to the GetDataMutable() function, which returns a pointer to a string's data. The function attempts to return the "mutable" data, but it cannot access the address of it and the debugger says,
  Cannot access memory at 0x0.
The address is usually 0x0, but sometimes it is 0xffffffff, or something similiar;
I have had trouble in the past with objects that carry these addresses. Does 0x0 stand for invalid memory position? The PointMesh function goes through all of it's steps, but when it initializes a pointer to the celEntity which has the name I specified, the pointer is not a valid address to my entity. The same happens for the PcMesh of course, since it is queried from the entity, but even the region that I specified does not get initialized. Nothing does. At the very end of the function, then my debugger shows the whole function command even though the function is basicly finished. My debugger does this with all functions; it is as if the function is being reexecuted after it has prepared itself, though I guess this isn't so. The command, looks like this,
0x4137c8ee in celPcZoneManager::PointMesh (this=0x6e656700,
  entity=0x73726f54 <Address 0x73726f54 out of bounds>,
  regionname=0x6361466f <Address 0x6361466f out of bounds>,
  startname=0x79726f74 <Address 0x79726f74 out of bounds>)
  at plugins/propclass/zone/zone.cpp:1440
Then, in spite of those errors, the function returns, 0, which I believe means CEL_ZONEERROR_OK, but my program glitches right after and sends out a segmentation fault.
     I passed the same entity name and region name to a function that I made for placing a mesh into a sector and it's corresponding celRegion and my function doesn't have trouble with the const char pointers. Although it doesn't use the Replace function on them, it does use
GetDataMutable() and it has no memory access problems while doing so. However, my function is nonfunctional in other ways.
     Could anyone tell me why memory can be unaccessible? Could I be attempting to access private members of a class, or is the reason always that the memory space I am examining is not a valid patch of memory? I need to ask more questions later, please respond if you can shed light on my problems.
                                                                                                                                                                       Sincerely,
                                                                                                                                        StewyP of the Eridanus Project
Logged
Darek
Newbie
*
Posts: 48



View Profile
« Reply #1 on: November 09, 2007, 05:07:18 pm »

probably entities are invalid hen. check why.
and always valid your pointers using if, don't let it crash e.g.:

mypointer->GetIt ()
if (mypointer)
  SomethingElseUsing (mypointer);
else
  printf ("your pointer is ivalid");
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.156 seconds with 15 queries.