Does Object Exist(Or Something)

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Wed May 13, 2009 4:31 am

Okay, I have a question about some plugin things. I just found a crash associated with my IK plugin. If the objects the IK plugin is using aren't there(if you have them destroyed at the start, for example), Construct will crash since it can't find any objects to use. I know Construct shouldn't crash, but is there some code I need to put into my plugin to keep it from crashing?
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Wed May 13, 2009 9:37 am

When it crashes, does it crash in your plugin? Use debug to find out. If it doesn't, then you should submit it as a bug.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Wed May 13, 2009 10:49 am

If you're using something like GetTypeInstances, it'll return NULL and 0 if no instances exist, so you just need some basic error checking. If you're holding a pointer to an object (CRunObject*), if it's destroyed the pointer becomes invalid. You must check the object->info.destroying flag in OnFrame2(), and if it's set true, you must stop using the pointer (set it to NULL/erase it/whatever's appropriate).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Fri May 15, 2009 3:19 am

Rich - Construct crashes. I'll go ahead and submit it as a bug as soon as I can.

Ashley - I'm pretty sure I'm using CRunObject, but I need to reinstall VC so I can check. Ultimately, I kind of stumbled around like a blind person when making the plugin. :P
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Fri May 15, 2009 9:17 am

But is it a function call from your object? If so which?

I'd use the debugger religiously so you have information to put in the report, if it turns out to be a bug on our side.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Fri May 15, 2009 1:45 pm

I've seen the bug report, but this still sounds like a bug in your plugin. Even if it crashed in Construct it could easily be a bug in your plugin, eg. if your plugin calls a runtime function which crashes because you called it wrong, the crash will occur in the runtime, but will have been caused by your plugin further up the call stack. It's still possible to cause the runtime to crash even if the plugin isn't in the call stack with a badly written plugin. Maybe if you attach the source code to the bug report I can take a look.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sat Jun 13, 2009 7:32 am

I finally got around to fixing this. Or rather, I completely rewrote the plugin. :P I added some error checking, and everything works perfectly now.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sat Jun 13, 2009 10:05 am

error checking++
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 1 guest