🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Bug with parameters
I have a registered object for string.
I've declare a function: pEngine->RegisterObjectMethod("CWeb","bool get(const string& in,string &out)",asMETHOD(CWeb,Get),asCALL_THISCALL);
That's my c++ function: bool CWeb::Get(const CString& szURL,CString& szHTML);
Inside my script, I've tried to call the function in 2 different ways:
web.get("http://website/?"+szQuery,szHTML);
string url="http://website/?"+szQuery;
web.get(url,szHTML);
The second call works just fine, but the first call crashes. szHTML is NULL and not points to a valid structure.
I'm using AS 2.8.
Gilad
Probably a bug in AngelScript with the temporary variables being released too early. I'll check it out.
I'll try to reproduce it with asCScriptString, but if that doesn't work I'll need to see your CString registration.
Regards,
Andreas
I'll try to reproduce it with asCScriptString, but if that doesn't work I'll need to see your CString registration.
Regards,
Andreas
I seem to remember testing this bug before, or at least a very similar one. Perhaps it was even you who reported it?
Anyway, I'm not able to reproduce this problem with asCScriptString. Perhaps it's in how you registered your string type?
I've checked in my attempt at reproducing the problem under revision 93. Would you be interested in downloading this version and running test_feature? You're particular problem is tested in test_scriptstring.cpp (the last part of the test function).
Regards,
Andreas
Anyway, I'm not able to reproduce this problem with asCScriptString. Perhaps it's in how you registered your string type?
I've checked in my attempt at reproducing the problem under revision 93. Would you be interested in downloading this version and running test_feature? You're particular problem is tested in test_scriptstring.cpp (the last part of the test function).
Regards,
Andreas
I'm not using std::string.
I've sent you an email with my asCString class. You are welcome to include it with AngelScript release so people can use it instead of std::string.
I've sent you an email with my asCString class. You are welcome to include it with AngelScript release so people can use it instead of std::string.
In my asString class.
It works fine.
I think it was not a bug of angelscript.
Maybe your asCScriptString doesn't register "+" operator.
It works fine.
I think it was not a bug of angelscript.
Maybe your asCScriptString doesn't register "+" operator.
Here is my asCString class (http://gilad.gsetup.com/downloads/angelCString.h)
I'll welcome any comments.
You are welcome all to use it in case you find it useful.
I'll welcome any comments.
You are welcome all to use it in case you find it useful.
Sorry for taking so long about looking into this bug. I finally got some time left over for this today, and I've been able to reproduce the bug using your atl::cstring implementation, and also my own std::string implementation.
Both of these implementations lack support for object handles, while asCScriptString supports object handles. It would thus seem that the problem has something to do with that.
It shouldn't be long before I have the fix for this now that I'm able to reproduce it. (Though it may still take a couple days, depending on how much free time I have the coming days)
Regards,
Andreas
Both of these implementations lack support for object handles, while asCScriptString supports object handles. It would thus seem that the problem has something to do with that.
It shouldn't be long before I have the fix for this now that I'm able to reproduce it. (Though it may still take a couple days, depending on how much free time I have the coming days)
Regards,
Andreas
Dug a little deeper and I discovered the problem. It's the same problem that I've had in other situations, the temporary string object that is being passed to the second argument is reused during the string concatenation in the expression for the first argument.
I don't have time to work on this anymore today. But now I know what it is so it shouldn't be more than one more hour of work to have it fixed.
In a future version I'll redesign the way temporary variables are handled so that problems like these won't happen again.
Regards,
Andreas
I don't have time to work on this anymore today. But now I know what it is so it shouldn't be more than one more hour of work to have it fixed.
In a future version I'll redesign the way temporary variables are handled so that problems like these won't happen again.
Regards,
Andreas
I managed to fix the bug today for 2.8.0. You can get the fix with revision 97 in the SVN.
Regards,
Andreas
Regards,
Andreas
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement