Does QString has any limitation in Android environment for Qt 5.15.2?
-
Hi,
I recently moved my Windows/Android application to Qt 5.15.2 from Qt 5.12.9. I see no issues for Windows part, however, i observed a strange behaviour of QString in Android environment. It seems like there is a limitation on the length of the string.
eg.QString temp = "rR64dZUTT8o1cn2QPZgz5XLtniNCo2vzKmyYEn23apgxlpmYVuRuVOB0utOVP7P4N6RHuv" "FMM2JnFnTJZPGBOxclYFTocyv0YEC17hTOGM5s0KpPI707xxBP4AcYTuq7AKhFXhUjNRnJ" "nyb4kPDukgVEk2GWuaCMIIKytmlEVRKGeKO3EJp5FdrdfXOth67Foa97n8ASopJeoXOL1x" "Jz7EjqUXz7tGmQT55RG7s5Qv701Kbfo7X4KE4cu8P9GM48tlCePLo0e7xsxyM9qzaW33Wx" "XHqEesSiQLpNR8S8Be0MpD5p7IYvWjUDl05oNXcjMJfKauZ3HiSC0FK6JZfxck8ttKbeF9" "N5X5pnLrn9xf0G06iFlULg0zg83SAHp5kHJC5sjKOUWt8vsBavbBIANARwX0bCEsk7Ai1I" "RxY91mNcVO4cjiDDXi5nzxd4HQLa5LvVjCsdrCgZm23CD1kCVjfaQXvGUTBEResApiwAmN" "ZDmj8KCFZSrztl2lGsYJOgmfgZXtjShO5VtOJo6OBZjzhoQ10RbLzB0rUwMFSSudOFgnd0" "A79HYEeTcvjyJmwGUjNw6JG7Qt8T2kgkA961Uc6JsBp5M3zrDqmRP3SLSlv5V3bVXdpvP7" "SGY8K0sZuIRqXKp7MJlBu3u56Z55VeDNkeQdDJBfaTWfcUF5Xb6LziqprsyBxGsUjebjJP" "cgrrEMPqDDxaUKKJ93pUG2rStclUd9XWr3Y1NFr4DgZyNgUIaUbqgPHiNNy9B9b1aOjhJZ" "UX2MD7tSp8HAfInhCvrUbQoUqWe6u5jr8yAeS4Q5IhqC8jw858Kflu6nJlMtCXv3jbe2Q0" "V0cngDkZ32SLS57g35Iu1rpXP6DLxrCtpu4H9FyTv3rcfyR92RLwa2sjKvb4qC3hGEYNEb" "GTqYifaGx2o0WNPcseYllTxRdO4YoQXvCddksz25iC7X2VEfnkZDO5hG1EZvg2LzmG9ASH" "8Ve0WMOhc09fPZFkdFzrNwULWXFVjNyWMklyIsto44HhfGWbn7xW3umDGsMyJRFKqannYG" "5Aj3hoMnuANActvGVrVG0eGc710vF4RK9yHFQq3y2xPGtUghy6pvMWf1CKTZeZvNTm8xeO" "WtrOGcGflKJ3g7mxYCLxsxMttA5AkcyRzs0m2egTADxVLHgsfacvqwStr189nZbyYgHg2v" "UlqeFraw7ZKZDOP1u28ZLhdnU2ZDh3vAWQUIUwPFLLpKWgR6eWAS9FSRzIwsln4oi4jLYq" "NSu7mVyqawHgaeggOv36oO40wugzThi34n5bmClMlYWXzCCiXoVjsX34MKjNXNhGaZvh5B" "WQkD5oQ7vY095GoFvg8ao6MMK00wLC05L8i7dcQXuD6rky9JrxuC3hta0ju38jx0X673oH" "potqo0DX7N7lSme7JC0gzuo5RUonMlKh9uy7IXUQV6yAkKNViLa3Wsj6r76WoxqFjUJPlT" "KEuzEGjPCubGQR8u1UPIYiYp0KirlZ"; qDebug() << "Random string" << temp;
will yield me:
Random string "rR64dZUTT8o1cn2QPZgz5XLtniNCo2vzKmyYEn23apgxlpmYVuRuVOB0utOVP7P4N6RHuvFMM2JnFnTJZPGBOxclYFTocyv0YEC17hTOGM5s0KpPI707xxBP4AcYTuq7AKhFXhUjNRnJnyb4kPDukgVEk2GWuaCMIIKytmlEVRKGeKO3EJp5FdrdfXOth67Foa97n8ASopJeoXOL1xJz7EjqUXz7tGmQT55RG7s5Qv701Kbfo7X4KE4cu8P9GM48tlCePLo0e7xsxyM9qzaW33WxXHqEesSiQLpNR8S8Be0MpD5p7IYvWjUDl05oNXcjMJfKauZ3HiSC0FK6JZfxck8ttKbeF9N5X5pnLrn9xf0G06iFlULg0zg83SAHp5kHJC5sjKOUWt8vsBavbBIANARwX0bCEsk7Ai1IRxY91mNcVO4cjiDDXi5nzxd4HQLa5LvVjCsdrCgZm23CD1kCVjfaQXvGUTBEResApiwAmNZDmj8KCFZSrztl2lGsYJOgmfgZXtjShO5VtOJo6OBZjzhoQ10RbLzB0rUwMFSSudOFgnd0A79HYEeTcvjyJmwGUjNw6JG7Qt8T2kgkA961Uc6JsBp5M3zrDqmRP3SLSlv5V3bVXdpvP7SGY8K0sZuIRqXKp7MJlBu3u56Z55VeDNkeQdDJBfaTWfcUF5Xb6LziqprsyBxGsUjebjJPcgrrEMPqDDxaUKKJ93pUG2rStclUd9XWr3Y1NFr4DgZyNgUIaUbqgPHiNNy9B9b1aOjhJZUX2MD7tSp8HAfInhCvrUbQoUqWe6u5jr8yAeS4Q5IhqC8jw858Kflu6nJlMtCXv3jbe2Q0V0cngDkZ32SLS57g35Iu1rpXP6DLxrCtpu4H9FyTv3rcfyR92RLwa2sjKvb4qC3hGEYNEbGTqYifaGx2o0WNPcseYllTxRdO4YoQXvCddksz25iC7X2VEfnkZDO5hG1EZvg2LzmG9ASH8Ve0WMOhc09fPZFkdFzrNwULWXFVI checked in the Qt bug list but could find any reference of the same.
-
Please check if
temp.size()
returns the same value on desktop and Android. Perhaps the string is only truncated during printing but internally the whole data is still there.Also a general remark: since this is an ASCI string you can save a lot of memory by using
QLatin1String
here instead ofQString
. -
Hm yes the number is very interesting indeed, looks like it is no coincidence.
... but I still think the string itself is fine and only in printing it is misrepresented. Otherwise it would be a very, very serious issue in Qt and I imagine it would have been detected earlier.
-
@sierdzio Yes, you are right! The size of temp is correct on both the platforms. Only in case of window the string is printed completely. Perhaps the limitation of
qDebug
in Android environment.
However, my quest to identify the source of crash remains! I am using Qstring to save a large Sqlite query and only in the case on Android, I am getting this crash duringexecSql
.
Anyways, thanks for your inputs!Best Regards,
M -
Hi,
What do you mean by large SQLite query ? How large ? What makes it so large ?
-
@SGaist It is an insert query with 1612 characters. Works perfectly well in windows but fail when cross-compile in Android and perform the same action.
If I replace the query with something smaller, it works in Android. That's why I suspected QString can be an issue here. -
Try running it with debugger attached, should show you where the issue occurs.
-
Just to help narrow things, are you building the whole query string or are you binding values ?
-
I think I identified the problem. The codebase doesn't solely rely on Sqlite plugin of Qt but also on external sqlite Library for certain operations while still using Qt connections to execute the query. Due to this shift in Qt version, maybe the Qt plugin and external lib were incompatible.
Qt 5.12.9 uses sqlite 3.32.1 in the sources while Qt 5.15.9 uses sqlite 3.33.0.
I simply changed to external lib to 3.33.0 (same as what Qt uses) and the query was handled correctly.Anyways, Thank you so much for your help!
-
That was a nasty one. Glad you found out and thanks for sharing !
-