Advertisement

Dictionary with multiple string values segfaults

Started by October 26, 2022 01:59 PM
6 comments, last by WitchLord 2 years ago

Hi,

If I define dictionary like this with strings as values, I get a segfault at execute:

dictionary dict = {{'text',"huu"},{'text2',"haa"}};

Same with ints, or only one string works ok.

Am I doing something wrong, or is this a bug?

v 2.36.0 on 64-bit Ubuntu.

//HS

Hi henris42,

this doesn't cause any problem for me. Are you using any non-default configurations or add-ons? Can you send me your engine configuration? You can easily retrieve it with a call to WriteConfigToFile from the scripthelper.cpp add-on.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Here is the config:

// AngelScript 2.36.0
// Lib options  AS_64BIT_PTR AS_LINUX AS_X64_GCC 
// Engine properties
ep 0 0
ep 1 1
ep 2 1
ep 3 1
ep 4 0
ep 5 0
ep 6 0
ep 7 0
ep 8 0
ep 9 1
ep 10 0
ep 11 1
ep 12 0
ep 13 0
ep 14 2
ep 15 0
ep 16 1
ep 17 0
ep 18 0
ep 19 1
ep 20 0
ep 21 0
ep 22 0
ep 23 0
ep 24 0
ep 25 0
ep 26 1
ep 27 100
ep 28 1
ep 29 4096
ep 30 10
ep 31 0
ep 32 0
ep 33 0

// Enums

// Types
access ffffffff
objtype "string" 7938
objtype "any" 5
objtype "array<T>" 69
objtype "dictionaryValue" 6022
objtype "dictionary" 5
objtype "ScriptedDevice_t" 1
objtype "HTTPRequest" 1
objtype "LwObject" 1
objtype "BTDevice" 1
objtype "BTService" 1
objtype "BTCharacteristic" 1
objtype "BTDescriptor" 1
objtype "AndroidAPI" 1
funcdef "bool array::less(const T&in, const T&in)"
funcdef "void VoidCB()"
funcdef "void StringCB(string&inout)"
funcdef "void BytesCB(array<uint8>&in)"

// Template type members
objbeh "array<T>" 3 "array<T>@ array(int&in)"
objbeh "array<T>" 3 "array<T>@ array(int&in, uint)"
objbeh "array<T>" 3 "array<T>@ array(int&in, uint, const T&in)"
objbeh "array<T>" 5 "void $beh5()"
objbeh "array<T>" 6 "void $beh6()"
objbeh "array<T>" 9 "int $beh9()"
objbeh "array<T>" 10 "void $beh10()"
objbeh "array<T>" 11 "bool $beh11()"
objbeh "array<T>" 12 "void $beh12(int&in)"
objbeh "array<T>" 13 "void $beh13(int&in)"
objbeh "array<T>" 8 "bool $beh8(int&in, bool&out)"
objbeh "array<T>" 4 "array<T>@ $list(int&in, int&in) { repeat T }"
objmthd "array<T>" "T& opIndex(uint)"
objmthd "array<T>" "const T& opIndex(uint) const"
objmthd "array<T>" "array<T>& opAssign(const array<T>&in)"
objmthd "array<T>" "void insertAt(uint, const T&in)"
objmthd "array<T>" "void insertAt(uint, const array<T>&inout)"
objmthd "array<T>" "void insertLast(const T&in)"
objmthd "array<T>" "void removeAt(uint)"
objmthd "array<T>" "void removeLast()"
objmthd "array<T>" "void removeRange(uint, uint)"
objmthd "array<T>" "uint length() const"
objmthd "array<T>" "void reserve(uint)"
objmthd "array<T>" "void resize(uint)"
objmthd "array<T>" "void sortAsc()"
objmthd "array<T>" "void sortAsc(uint, uint)"
objmthd "array<T>" "void sortDesc()"
objmthd "array<T>" "void sortDesc(uint, uint)"
objmthd "array<T>" "void reverse()"
objmthd "array<T>" "int find(const T&in) const"
objmthd "array<T>" "int find(uint, const T&in) const"
objmthd "array<T>" "int findByRef(const T&in) const"
objmthd "array<T>" "int findByRef(uint, const T&in) const"
objmthd "array<T>" "bool opEquals(const array<T>&in) const"
objmthd "array<T>" "bool isEmpty() const"
objmthd "array<T>" "void sort(array::less&in, uint = 0, uint = uint ( - 1 ))"

// Type members
objbeh "string" 2 "void string()"
objbeh "string" 0 "void string()"
objbeh "string" 0 "void string(const string&in)"
objmthd "string" "string& opAssign(const string&in)"
objmthd "string" "string& opAddAssign(const string&in)"
objmthd "string" "bool opEquals(const string&in) const"
objmthd "string" "int opCmp(const string&in) const"
objmthd "string" "string opAdd(const string&in) const"
objmthd "string" "uint length() const"
objmthd "string" "void resize(uint)"
objmthd "string" "bool isEmpty() const"
objmthd "string" "uint8& opIndex(uint)"
objmthd "string" "const uint8& opIndex(uint) const"
objmthd "string" "string& opAssign(double)"
objmthd "string" "string& opAddAssign(double)"
objmthd "string" "string opAdd(double) const"
objmthd "string" "string opAdd_r(double) const"
objmthd "string" "string& opAssign(float)"
objmthd "string" "string& opAddAssign(float)"
objmthd "string" "string opAdd(float) const"
objmthd "string" "string opAdd_r(float) const"
objmthd "string" "string& opAssign(int64)"
objmthd "string" "string& opAddAssign(int64)"
objmthd "string" "string opAdd(int64) const"
objmthd "string" "string opAdd_r(int64) const"
objmthd "string" "string& opAssign(uint64)"
objmthd "string" "string& opAddAssign(uint64)"
objmthd "string" "string opAdd(uint64) const"
objmthd "string" "string opAdd_r(uint64) const"
objmthd "string" "string& opAssign(bool)"
objmthd "string" "string& opAddAssign(bool)"
objmthd "string" "string opAdd(bool) const"
objmthd "string" "string opAdd_r(bool) const"
objmthd "string" "string substr(uint = 0, int = - 1) const"
objmthd "string" "int findFirst(const string&in, uint = 0) const"
objmthd "string" "int findFirstOf(const string&in, uint = 0) const"
objmthd "string" "int findFirstNotOf(const string&in, uint = 0) const"
objmthd "string" "int findLast(const string&in, int = - 1) const"
objmthd "string" "int findLastOf(const string&in, int = - 1) const"
objmthd "string" "int findLastNotOf(const string&in, int = - 1) const"
objmthd "string" "void insert(uint, const string&in)"
objmthd "string" "void erase(uint, int = - 1)"
objbeh "any" 3 "any@ any()"
objbeh "any" 3 "any@ any(?&in)"
objbeh "any" 3 "any@ any(const int64&in)"
objbeh "any" 3 "any@ any(const double&in)"
objbeh "any" 5 "void $beh5()"
objbeh "any" 6 "void $beh6()"
objbeh "any" 9 "int $beh9()"
objbeh "any" 10 "void $beh10()"
objbeh "any" 11 "bool $beh11()"
objbeh "any" 12 "void $beh12(int&in)"
objbeh "any" 13 "void $beh13(int&in)"
objmthd "any" "any& opAssign(any&in)"
objmthd "any" "void store(?&in)"
objmthd "any" "void store(const int64&in)"
objmthd "any" "void store(const double&in)"
objmthd "any" "bool retrieve(?&out)"
objmthd "any" "bool retrieve(int64&out)"
objmthd "any" "bool retrieve(double&out)"
objbeh "dictionaryValue" 2 "void dictionaryValue()"
objbeh "dictionaryValue" 12 "void $beh12(int&in)"
objbeh "dictionaryValue" 13 "void $beh13(int&in)"
objbeh "dictionaryValue" 0 "void dictionaryValue()"
objmthd "dictionaryValue" "dictionaryValue& opAssign(const dictionaryValue&in)"
objmthd "dictionaryValue" "dictionaryValue& opHndlAssign(const ?&in)"
objmthd "dictionaryValue" "dictionaryValue& opHndlAssign(const dictionaryValue&in)"
objmthd "dictionaryValue" "dictionaryValue& opAssign(const ?&in)"
objmthd "dictionaryValue" "dictionaryValue& opAssign(double)"
objmthd "dictionaryValue" "dictionaryValue& opAssign(int64)"
objmthd "dictionaryValue" "void opCast(?&out)"
objmthd "dictionaryValue" "void opConv(?&out)"
objmthd "dictionaryValue" "int64 opConv()"
objmthd "dictionaryValue" "double opConv()"
objbeh "dictionary" 3 "dictionary@ dictionary()"
objbeh "dictionary" 5 "void $beh5()"
objbeh "dictionary" 6 "void $beh6()"
objbeh "dictionary" 9 "int $beh9()"
objbeh "dictionary" 10 "void $beh10()"
objbeh "dictionary" 11 "bool $beh11()"
objbeh "dictionary" 12 "void $beh12(int&in)"
objbeh "dictionary" 13 "void $beh13(int&in)"
objbeh "dictionary" 4 "dictionary@ $list(int&in) { repeat { string, ? } }"
objmthd "dictionary" "dictionary& opAssign(const dictionary&in)"
objmthd "dictionary" "void set(const string&in, const ?&in)"
objmthd "dictionary" "bool get(const string&in, ?&out) const"
objmthd "dictionary" "void set(const string&in, const int64&in)"
objmthd "dictionary" "bool get(const string&in, int64&out) const"
objmthd "dictionary" "void set(const string&in, const double&in)"
objmthd "dictionary" "bool get(const string&in, double&out) const"
objmthd "dictionary" "bool exists(const string&in) const"
objmthd "dictionary" "bool isEmpty() const"
objmthd "dictionary" "uint getSize() const"
objmthd "dictionary" "bool delete(const string&in)"
objmthd "dictionary" "void deleteAll()"
objmthd "dictionary" "array<string>@ getKeys() const"
objmthd "dictionary" "dictionaryValue& opIndex(const string&in)"
objmthd "dictionary" "const dictionaryValue& opIndex(const string&in) const"
objbeh "ScriptedDevice_t" 3 "ScriptedDevice_t@ ScriptedDevice_t()"
objbeh "ScriptedDevice_t" 5 "void $beh5()"
objbeh "ScriptedDevice_t" 6 "void $beh6()"
objbeh "HTTPRequest" 3 "HTTPRequest@ HTTPRequest(string)"
objbeh "HTTPRequest" 5 "void $beh5()"
objbeh "HTTPRequest" 6 "void $beh6()"
objmthd "HTTPRequest" "void setUser(string, string)"
objmthd "HTTPRequest" "bool get(string, StringCB@)"
objmthd "HTTPRequest" "bool post(string, StringCB@)"
objbeh "LwObject" 3 "LwObject@ LwObject(int)"
objbeh "LwObject" 5 "void $beh5()"
objbeh "LwObject" 6 "void $beh6()"
objmthd "LwObject" "double getFloatValue(int)"
objmthd "LwObject" "void setFloatValue(int, double)"
objmthd "LwObject" "int getIntValue(int)"
objmthd "LwObject" "bool getBoolValue(int)"
objmthd "LwObject" "void setIntValue(int, int)"
objmthd "LwObject" "void setBoolValue(int, bool)"
objmthd "LwObject" "string getStringValue(int)"
objmthd "LwObject" "void setStringValue(int, string)"
objmthd "LwObject" "void registerAnjay()"
objmthd "LwObject" "void addResource(int, string, int, int)"
objmthd "LwObject" "void setWriteCB(int, ScriptedDevice_t@, VoidCB@)"
objmthd "LwObject" "void setReadCB(int, ScriptedDevice_t@, StringCB@)"
objmthd "LwObject" "void setExecCB(int, ScriptedDevice_t@, VoidCB@)"
objbeh "BTDevice" 3 "BTDevice@ BTDevice()"
objbeh "BTDevice" 5 "void $beh5()"
objbeh "BTDevice" 6 "void $beh6()"
objmthd "BTDevice" "void discoverByService(string, int)"
objmthd "BTDevice" "void discoverByName(string, int)"
objmthd "BTDevice" "string getName()"
objmthd "BTDevice" "string getAddress()"
objmthd "BTDevice" "bool connect()"
objmthd "BTDevice" "bool isConnected()"
objmthd "BTDevice" "void setDidConnectCB(VoidCB@)"
objmthd "BTDevice" "void setDidDisconnectCB(VoidCB@)"
objmthd "BTDevice" "BTService@ getService(string)"
objbeh "BTService" 5 "void $beh5()"
objbeh "BTService" 6 "void $beh6()"
objmthd "BTService" "BTCharacteristic@ getCharacteristic(string)"
objbeh "BTCharacteristic" 5 "void $beh5()"
objbeh "BTCharacteristic" 6 "void $beh6()"
objmthd "BTCharacteristic" "bool notificationsSupported()"
objmthd "BTCharacteristic" "bool subscribe()"
objmthd "BTCharacteristic" "void unsubscribe()"
objmthd "BTCharacteristic" "void setReceiveCB(BytesCB@)"
objmthd "BTCharacteristic" "void write(array<uint8>&in)"
objmthd "BTCharacteristic" "array<uint8>@ read()"
objmthd "BTCharacteristic" "string readString()"
objmthd "BTCharacteristic" "BTDescriptor@ getDescriptor(string)"
objbeh "BTDescriptor" 5 "void $beh5()"
objbeh "BTDescriptor" 6 "void $beh6()"
objmthd "BTDescriptor" "int getIntValue()"
objmthd "BTDescriptor" "string getStringValue()"
objbeh "AndroidAPI" 5 "void $beh5()"
objbeh "AndroidAPI" 6 "void $beh6()"
objmthd "AndroidAPI" "array<uint8>@ requestOmron(array<uint8>&in)"
objmthd "AndroidAPI" "bool probeOmron()"

// Functions
func "string formatInt(int64, const string&in = \"\", uint = 0)"
func "string formatUInt(uint64, const string&in = \"\", uint = 0)"
func "string formatFloat(double, const string&in = \"\", uint = 0, uint = 0)"
func "int64 parseInt(const string&in, uint = 10, uint&out = 0)"
func "uint64 parseUInt(const string&in, uint = 10, uint&out = 0)"
func "double parseFloat(const string&in, uint&out = 0)"
func "float fpFromIEEE(uint)"
func "uint fpToIEEE(float)"
func "double fpFromIEEE(uint64)"
func "uint64 fpToIEEE(double)"
func "bool closeTo(float, float, float = 0.00001f)"
func "bool closeTo(double, double, double = 0.0000000001)"
func "float cos(float)"
func "float sin(float)"
func "float tan(float)"
func "float acos(float)"
func "float asin(float)"
func "float atan(float)"
func "float atan2(float, float)"
func "float cosh(float)"
func "float sinh(float)"
func "float tanh(float)"
func "float log(float)"
func "float log10(float)"
func "float pow(float, float)"
func "float sqrt(float)"
func "float ceil(float)"
func "float abs(float)"
func "float floor(float)"
func "float fraction(float)"
func "void print(const string&in)"
func "void print(int)"
func "void print(double)"
func "void print(bool)"
func "string itoa(int)"
func "string dtoa(double)"
func "string booltoa(bool)"
func "int atoi(string)"
func "bool atobool(string)"
func "double atod(string)"
func "double utod(int)"
func "bool isdigit(string)"
func "bool isspace(string)"
func "bool isalpha(string)"
func "double round(double)"
func "string isoDateTime()"
func "string itohex(int)"
func "string base64Encode(string, bool)"
func "string base64Decode(string, bool)"
func "void sleep(int)"
func "int time()"
func "uint random()"
func "void setInitialized(bool)"
func "LwObject@ getInstance(int, int)"

// Properties
prop "AndroidAPI android"

// String factory
strfactory "string"

// Default array type
defarray "array<T>"

I also noticed that https://github.com/Paranoid-AF/Jsona​ does not compile anymore, it gives:

/as_compiler.cpp:1190: void asCCompiler::CompileStatementBlock(asCScriptNode*, bool, bool*, asCByteCode*): Assertion `tempVariables.GetLength() == 0' failed.

It used to compile fine with few versions earlier.

I still haven't been able to reproduce the original problem you reported.

The problem you see with Jsona is already fixed in the latest wip version.

There is a slight chance that the problem you reported is also related to the same fix. Can you try the latest wip version and let me know if it works?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Yes, I think the WIP version fixed everything, thanks!

Advertisement

Great! Thanks for the confirmation.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement