void wlc_view_release(struct wlc_view *view) { if (!view) return; wlc_view_unmap(view); wlc_view_set_parent_ptr(view, NULL); wlc_resource_release(view->shell_surface); wlc_resource_release(view->xdg_surface); wlc_resource_release(view->xdg_popup); chck_string_release(&view->data.title); chck_string_release(&view->data._class); chck_string_release(&view->data.app_id); wlc_surface_attach_to_view(convert_from_wlc_resource(view->surface, "surface"), NULL); chck_iter_pool_release(&view->wl_state); }
static void do_autostart(void) { struct chck_string key = {0}, command = {0}; struct chck_iter_pool argv; if (!chck_iter_pool(&argv, 4, 4, sizeof(char*))) return; for (uint32_t i = 0; ; i++) { if (!chck_string_set_format(&key, "/autostart/%u", i)) break; const char *command_cstr; if (!configuration_get(key.data, 's', &command_cstr)) break; if (!chck_string_set_cstr(&command, command_cstr, true)) break; char *t; size_t len; const char *state = NULL; while ((t = (char*)chck_cstr_tokenize_quoted(command.data, &len, " ", "\"'", &state))) { chck_iter_pool_push_back(&argv, &t); t[len] = 0; /* replaces each token with \0 */ } const char *null = NULL; chck_iter_pool_push_back(&argv, &null); /* NULL indicates end of the array */ plog(plugin.self, PLOG_INFO, "spawning: %s", command_cstr); wlc_exec(command.data, chck_iter_pool_to_c_array(&argv, NULL)); chck_iter_pool_empty(&argv); } chck_string_release(&key); chck_string_release(&command); chck_iter_pool_release(&argv); }