Fix file descriptor leaks, obs plugin settings
This commit is contained in:
@@ -76,7 +76,7 @@ struct mod_state {
|
|||||||
gs_texture_t* gs_tex;
|
gs_texture_t* gs_tex;
|
||||||
unsigned int old_tex;
|
unsigned int old_tex;
|
||||||
struct {
|
struct {
|
||||||
const char* opts;
|
char* opts;
|
||||||
int w, h;
|
int w, h;
|
||||||
} cfg;
|
} cfg;
|
||||||
};
|
};
|
||||||
@@ -182,8 +182,12 @@ static void update(void* data, obs_data_t* settings) {
|
|||||||
s->cfg.w = (int) obs_data_get_int(settings, "width");
|
s->cfg.w = (int) obs_data_get_int(settings, "width");
|
||||||
s->cfg.h = (int) obs_data_get_int(settings, "height");
|
s->cfg.h = (int) obs_data_get_int(settings, "height");
|
||||||
const char* opts = obs_data_get_string(settings, "options");
|
const char* opts = obs_data_get_string(settings, "options");
|
||||||
bool opts_changed = s->cfg.opts == NULL || strcmp(opts, s->cfg.opts) != 0;
|
printf("debug: input str '%s', set '%s'\n", opts, s->cfg.opts);
|
||||||
s->cfg.opts = opts;
|
bool opts_changed = s->cfg.opts == NULL || strcmp(opts, s->cfg.opts);
|
||||||
|
if (s->cfg.opts != NULL) {
|
||||||
|
free(s->cfg.opts);
|
||||||
|
}
|
||||||
|
s->cfg.opts = strdup(opts);
|
||||||
|
|
||||||
if (opts_changed) {
|
if (opts_changed) {
|
||||||
blog(LOG_INFO, "Updating GLava state");
|
blog(LOG_INFO, "Updating GLava state");
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ static struct schar directive(struct glsl_ext* ext, char** args,
|
|||||||
ext_process(&next, target);
|
ext_process(&next, target);
|
||||||
inherit(ext, &next);
|
inherit(ext, &next);
|
||||||
munmap(map, st.st_size);
|
munmap(map, st.st_size);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
ext->ss_lookup = next.ss_lookup;
|
ext->ss_lookup = next.ss_lookup;
|
||||||
|
|
||||||
|
|||||||
@@ -89,10 +89,8 @@ static void init(struct audio_data* audio) {
|
|||||||
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
pa_mainloop_run(m_pulseaudio_mainloop, &ret);
|
pa_mainloop_run(m_pulseaudio_mainloop, &ret);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sample format for native 'float' type */
|
/* Sample format for native 'float' type */
|
||||||
|
|||||||
@@ -888,18 +888,26 @@ struct glava_renderer* rd_new(const char** paths, const char* entry,
|
|||||||
const char* backend = force_backend;
|
const char* backend = force_backend;
|
||||||
|
|
||||||
/* Window creation backend interfaces */
|
/* Window creation backend interfaces */
|
||||||
|
|
||||||
|
if (wcbs_idx == 0) {
|
||||||
|
#ifdef GLAVA_GLFW
|
||||||
|
DECL_WCB(wcb_glfw);
|
||||||
|
#endif
|
||||||
|
#ifdef GLAVA_GLX
|
||||||
|
DECL_WCB(wcb_glx);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GLAVA_GLFW
|
#ifdef GLAVA_GLFW
|
||||||
DECL_WCB(wcb_glfw);
|
|
||||||
if (!forced) backend = "glfw";
|
if (!forced) backend = "glfw";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef GLAVA_GLX
|
#ifdef GLAVA_GLX
|
||||||
DECL_WCB(wcb_glx);
|
|
||||||
if (!forced && getenv("DISPLAY")) {
|
if (!forced && getenv("DISPLAY")) {
|
||||||
backend = "glx";
|
backend = "glx";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
fprintf(stderr, "No backend available for the active windowing system\n");
|
fprintf(stderr, "No backend available for the active windowing system\n");
|
||||||
if (wcbs_idx == 0) {
|
if (wcbs_idx == 0) {
|
||||||
@@ -1269,6 +1277,7 @@ struct glava_renderer* rd_new(const char** paths, const char* entry,
|
|||||||
ext_free(&ext);
|
ext_free(&ext);
|
||||||
|
|
||||||
munmap((void*) map, st.st_size);
|
munmap((void*) map, st.st_size);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
if (auto_desktop) {
|
if (auto_desktop) {
|
||||||
if (env) {
|
if (env) {
|
||||||
@@ -1305,6 +1314,7 @@ struct glava_renderer* rd_new(const char** paths, const char* entry,
|
|||||||
loading_presets = false;
|
loading_presets = false;
|
||||||
|
|
||||||
munmap((void*) map, st.st_size);
|
munmap((void*) map, st.st_size);
|
||||||
|
close(fd);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Failed to detect the desktop environment! "
|
fprintf(stderr, "Failed to detect the desktop environment! "
|
||||||
"Is the window manager EWMH compliant?");
|
"Is the window manager EWMH compliant?");
|
||||||
|
|||||||
Reference in New Issue
Block a user