martyj Posted October 5, 2016 Share Posted October 5, 2016 On my demo map, the game crashes whenever I drop an item. (And only on this map). I am on the Non-Beta branch. Here is the crash I receive: http://imgur.com/a/oVIJL Sample Code: Creation this->model = (Model*)Model::Load(item->GetModelPath(), Asset::Unmanaged); this->model->SetUserData(this); this->model->SetKeyValue("name", item->GetName()); this->model->SetVelocity(Vec3(0, 0, 0), true); this->model->SetCollisionType(Collision::Prop); this->model->SetPhysicsMode(Entity::RigidBodyPhysics); this->model->SetPickMode(Entity::SpherePick, true); this->model->SetMass(10); // TODO: real mass this->model->SetSweptCollisionMode(true); this->model->SetPosition(position, true); Destroy Code ItemEntity::~ItemEntity() { this->model->SetParent(NULL); this->model->Hide(); // TODO: Delete me this->model->SetUserData(NULL); this->model->Release(); } I can provide my full source code if needed. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted October 5, 2016 Share Posted October 5, 2016 That happens to me if I somehow use the model after I release it, even if I'd swear up and down that it's impossible. But if you're saying it doesn't happen on other maps then I'm not sure. Also, not sure if you check elsewhere but you may consider checking if model==NULL (and setting it at the start and after release). Quote Link to comment Share on other sites More sharing options...
martyj Posted October 5, 2016 Author Share Posted October 5, 2016 If you look at the stacktrace on the image, there is no way that I could use it after I release it as the exception is thrown in library code that is above my Release call in the stack. So it's somewhere in Leadwerks code that the crash happens, in the RemoveAll function. Quote Link to comment Share on other sites More sharing options...
Undac Posted October 5, 2016 Share Posted October 5, 2016 Well, the Release() method works just fine for me, so I guess the problem is elsewhere. Before you call the destructor, do you see the item in game? If you're not sure it does, the problem might be the attempt to Hide() an empty model. The error happens when you try to call the destructor or when you exit the map? If it happens when you exit the map, maybe you call delete world before the destructor of ItemEntity. PS: I have no idea what Asset::Unmanaged is. Quote Link to comment Share on other sites More sharing options...
Josh Posted October 5, 2016 Share Posted October 5, 2016 For something like this I definitely need the project so I can run the code and see. 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
martyj Posted October 9, 2016 Author Share Posted October 9, 2016 My computer took a **** on me at the moment, I can get you GIT access right now, or in a week I can get you a zip of the project. Quote Link to comment Share on other sites More sharing options...
Josh Posted October 11, 2016 Share Posted October 11, 2016 A single zip file would be helpful. Thanks. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
martyj Posted October 17, 2016 Author Share Posted October 17, 2016 See PM with link and instructions on how to reproduce. Quote Link to comment Share on other sites More sharing options...
martyj Posted October 23, 2016 Author Share Posted October 23, 2016 Any update to this? I know you're super busy with the new UI. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted October 31, 2016 Share Posted October 31, 2016 I might be running in to a similar problem only using Lua. I'll wait and see if this issue gets resolved to see if it fixes my problem to. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted November 2, 2016 Share Posted November 2, 2016 Working on this this week, along with a few other peoples' projects. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.