Jump to content
  • Advertisement
Sign in to follow this  
Dentoid

CreateScriptObject problem

This topic is 4440 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi I've got a problem where CreateScriptObject returns a pointer to an uninitialized piece of memory (0xcdcdcdcd in debug VC8 build). The object I'm trying to create is a script declared class with a bunch of members and methods. If I add an empty or simple constructor to the class it will instead return a null pointer. (I did a quick trace of the constructor execution inside CreateScriptObject, and on the second system call it does, the first being to some GC_AddRef or something, it gets a null pointer exception. That is, a script null ptr exception, not a system "real memory" exception.) I've got no idea what's going on... I've tried comparing to the test_scriptclassmethod test, but can't find any obvious differences, except that my class exists in a module. Don't know what more info to give, but I'll keep investigating. Just wondering if anyone (i.e. WitchLord :) has got any idea. Thanks in advance /Anders EDIT: Just FYI, I'm using the 2.6.0 release.

Share this post


Link to post
Share on other sites
Advertisement
Just noticed that if I change the test_scriptclassmethod example to put the script2 script in another module (and update everything that accesses it to specify that module), CreateScriptObject returns 0 too. This time, however, because the constructor context can't be prepared.

I don't understand much what's going on here. Any help is welcome. :)

/Anders

Share this post


Link to post
Share on other sites
I'll try to reproduce this problem in order to determine what's going on.

It sounds like a bug in AngelScript though.

Thanks for letting me know.

Regards,
Andreas

Share this post


Link to post
Share on other sites
I managed to reproduce the problem the way you mentioned, and I know where the problem is: The ids for the script class methods don't reflect which module they were declared in. Unfortunately this was a situation that I overlooked and the solution is not so simple.

I'll have to think about this a little and decide upon a solution.

Share this post


Link to post
Share on other sites
Ah, okay. Thanks.

You might want to think about a way then to get the module a type id resides in too, since I found no way to do that as it is now (which I guess might be related). I mean... Currently, I can't for example get the method of a class by declaration if I haven't previously stored which module the type id was found in.

Hope that made sense. :)

Share this post


Link to post
Share on other sites
Good point. :)

I seem to have overlooked quite a big part with this design. Fortunately getting the module id from the type id is easy, though it requires a new method to the engine interface.

Share this post


Link to post
Share on other sites
Sounds good :)

Don't want to push it, but is there any ETA for these fixes? They're kind of a showstopper for me. :)

Share this post


Link to post
Share on other sites
You can be assured that this is a high priority for me, as I consider it to be a bug, not a new feature. Maybe I can have a fix ready for the weekend, but I can't guarantee anything.

Share this post


Link to post
Share on other sites
Btw, do you know if there's any fairly quick hack to make it work temporarily? Like passing the module manually into CreateScriptObject or something like that? (I'm not totally sure what's going wrong. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!