QGuiApplication crashed when passing Unicode string like Thai parameter?
-
Hi,
Can you reproduce that with a minimal compilable example ? What is the string that makes your application crash ?
-
@SGaist Sample code is at https://github.com/EightFingerDhuta/qt/tree/master/crashArgs。
Test string is "สวัสดี" in thai. But it will be ok when pass "你好" etc.This simplified sample runs ok in qtcreator (parameter passed in qtcreator), but fails when run it in
cmd
terminal after deploy it.In fact, my original app even cannot run in qtcreator. When delete all build files manually and rebuild it, it can run successfully only
once
. -
@dhuta what I meant to say is add
argv0[argc + 2] = NULL;
. That part aboutargv0[i] = NULL;
is wrong. Your code should look like this:int argc0 = argc + 2; char *argv0[argc0 + 1]; for (int i = 0; i < argc; i++) { argv0[i] = argv[i]; } argv0[argc] = arg1; argv0[argc + 1] = arg2; argv0[argc + 2] = NULL;
-
@ileonte I have already push the modified code. When i run it under debug mode, it crashs with a message:
ASSERT: "allArguments.size() == origArgc" in file kernel\qtcoreapplication.cpp line 2191
. I google it, it seems that this is an already known bug: https://bugreports.qt.io/browse/QTBUG-30330. Maybe i should found another way to get my wanted result.Thanks a lot !