- int rc2 = api_call("request_surface", j, [&rc](bool ok, json_object *j) {
- if (ok) {
- int id = json_object_get_int(json_object_object_get(j, "response"));
- char *buf;
- asprintf(&buf, "%d", id);
- printf("setenv(\"QT_IVI_SURFACE_ID\", %s, 1)\n", buf);
- if (setenv("QT_IVI_SURFACE_ID", buf, 1) != 0) {
- fprintf(stderr, "putenv failed: %m\n");
- rc = -errno;
+ int rc2 =
+ this->api_call("request_surface", j, [&rc](bool ok, json_object *j) {
+ if (ok) {
+ int id =
+ json_object_get_int(json_object_object_get(j, "response"));
+ char *buf;
+ asprintf(&buf, "%d", id);
+ printf("setenv(\"QT_IVI_SURFACE_ID\", %s, 1)\n", buf);
+ if (setenv("QT_IVI_SURFACE_ID", buf, 1) != 0) {
+ fprintf(stderr, "putenv failed: %m\n");
+ rc = -errno;
+ } else {
+ rc = 0; // Single point of success
+ }