Box2D Forums

It is currently Wed May 22, 2013 12:26 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sun Jul 10, 2011 12:43 pm 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
Hello

I get a EXC_BAD_ACCESS when running the game on the iphone. Under the simulator it
runs fine. It stops in b2PolygonShape::Clone when one goes to create a fixture on a body.

Any help would be appreciated.

c


Top
 Profile  
 
PostPosted: Sun Jul 10, 2011 7:27 pm 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1515
Location: Tokyo
Is it possible that the device has simply run out of memory?


Top
 Profile  
 
PostPosted: Sun Jul 10, 2011 10:57 pm 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
Could be, I was thinking about this fact today, i am going to check this today and report back.

Thanks
c


Top
 Profile  
 
PostPosted: Mon Jul 11, 2011 2:29 am 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
I rebooted the phone and the same problem.

It dies in this function,

Code:
b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
{
   void* mem = allocator->Allocate(sizeof(b2PolygonShape));
   b2PolygonShape* clone = new (mem) b2PolygonShape;
   *clone = *this;
   return clone;
}


on the line "*clone= *this"


Top
 Profile  
 
PostPosted: Mon Jul 11, 2011 2:58 am 
Offline

Joined: Tue Jun 24, 2008 8:25 pm
Posts: 1515
Location: Tokyo
Are you sure that the shape you are copying is valid? Is there anything else that is different on the device to the simulator?


Top
 Profile  
 
PostPosted: Mon Jul 11, 2011 10:06 am 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
The stack trace is as follows:
Code:
#0  0x00020a1c in b2PolygonShape::operator= (this=0xae73c6) at b2PolygonShape.h:27
#1  0x000209d0 in b2PolygonShape::Clone (this=0x2fdfe1a4, allocator=0x7800000) at /gggggg/Box2D/Collision/Shapes/b2PolygonShape.cpp:32
#2  0x00023692 in b2Fixture::Create (this=0xafc904, allocator=0x7800000, broadPhase=0x78191d8, body=0xae7324, xf=@0xae732c, def=0x2fdfe278) at /gggggg/Box2D/Dynamics/b2Fixture.cpp:57
#3  0x00021e58 in b2Body::CreateFixture (this=0xae7324, def=0x2fdfe278) at /ggggg/Box2D/Dynamics/b2Body.cpp:137
#4  0x000109d2 in -[GameLayer addBodyToPhysicsWorld:] (self=0xae3800, _cmd=0x22758d, physicsbody=0x6ed3e0) at /ggggg/Classes/GameLayer.mm:1537



Top
 Profile  
 
PostPosted: Mon Jul 11, 2011 11:34 am 
Offline

Joined: Thu Jul 29, 2010 12:04 pm
Posts: 11
Problem Solved. It seems another object was incorrectly destroyed right before this object creation. Once i fixed this, everything worked fine. I cant explain it and just happy its working

thanks
c


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group