The following line caused crashes:
IdMap[info->requestId] = info.release();
Argument evaluation order was not strictly defined in C++
before C++17 - behavior of the expression above was undefined.
C++17 introduced more strict rules and their implementation in GCC
caused a crash after setting -std=c++17 - it seems, that info.release()
would be now called before info->requestId.
[Verification] tct-datacontrol-tizen-tests (auto, c++14 and c++17 build):
100% pass rate
The snippet below crashed apps 100% times when webapi-plugins were
compiled with C++17. Now, the snippet works fine
var PROVIDER_ID =
"http://tizen.org/datacontrol/provider/DictionaryDataControlProvider";
var DATA_ID = "Dictionary";
var TYPE_SQL = "SQL";
var TYPE_MAP = "MAP";
var globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID,
DATA_ID,
TYPE_MAP);
function successcb(id) {
console.log("Ok: reqid " + id);
}
function errorcb(id, error) {
console.log("Error id: " + id + ", error msg: " + error.message);
}
try {
globalDataControl.addValue(123, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
console.log(err.name + ": " + err.message);
}
Change-Id: Ibd80f60d100a616b8a9607c27e9eebf8a64e7a10
result = job(handle, &info->requestId);
RETURN_IF_FAIL(result, "Doing job failed with error");
- IdMap[info->requestId] = info.release();
+ auto requestId = info->requestId;
+ IdMap[requestId] = info.release();
return result;
}
result = job(handle, &info->requestId);
RETURN_IF_FAIL(result, "Doing job failed with error");
- IdMap[info->requestId] = info.release();
+ auto requestId = info->requestId;
+ IdMap[requestId] = info.release();
return result;
}