aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/button.c7
-rw-r--r--src/button.h1
-rw-r--r--src/comet.c1
-rw-r--r--src/connect.c7
-rw-r--r--src/connect.h1
-rw-r--r--src/dwm.c6
-rw-r--r--src/state.c2
-rw-r--r--src/window.c5
8 files changed, 23 insertions, 7 deletions
diff --git a/src/button.c b/src/button.c
index 5039364..05a77ef 100644
--- a/src/button.c
+++ b/src/button.c
@@ -80,7 +80,12 @@ void button_set_line(Button *btn, Color line_color, int line_width)
void button_destroy(Button *btn)
{
- if (btn->simple) g_free(CAST(btn, ButtonSimple)->text);
animation_destroy(btn->anim);
+
+ if (btn->simple)
+ g_free(CAST(btn, ButtonSimple)->text);
+ else
+ g_list_free_full(CAST(btn, ButtonGroup)->children, (GDestroyNotify)button_destroy);
+
g_free(btn);
}
diff --git a/src/button.h b/src/button.h
index 57907b4..423e29a 100644
--- a/src/button.h
+++ b/src/button.h
@@ -31,6 +31,7 @@ typedef struct {
Color text_color;
char *text;
ButtonAction action;
+ // TODO: Add a GDestroyNotify
gpointer action_data;
} ButtonSimple;
diff --git a/src/comet.c b/src/comet.c
index b47c078..34c9b2a 100644
--- a/src/comet.c
+++ b/src/comet.c
@@ -182,6 +182,7 @@ static gboolean date_update(gpointer data)
its.it_value.tv_sec = 60 - (current.tv_sec % 60);
timer_settime(date_ctx->timer, 0, &its, NULL);
+ g_date_time_unref(time);
return G_SOURCE_CONTINUE;
}
diff --git a/src/connect.c b/src/connect.c
index ed5a23b..054153d 100644
--- a/src/connect.c
+++ b/src/connect.c
@@ -310,12 +310,13 @@ Connection *connect_create()
g_assert_null(error);
log_debug("RandR loaded [version=%d.%d]", randr_version->major_version, randr_version->minor_version);
g_assert_cmpint(randr_version->major_version, >=, 1);
+ g_free(randr_version);
xcb_randr_get_screen_info_cookie_t cookie = xcb_randr_get_screen_info(con->connection, con->screen->root);
- xcb_randr_get_screen_info_reply_t *info_reply = xcb_randr_get_screen_info_reply(con->connection, cookie, &error);
+ con->info_reply = xcb_randr_get_screen_info_reply(con->connection, cookie, &error);
g_assert_null(error);
- con->screen_size = xcb_randr_get_screen_info_sizes(info_reply);
+ con->screen_size = xcb_randr_get_screen_info_sizes(con->info_reply);
g_assert_nonnull(con->screen_size);
log_debug("Screen size [width=%d, height=%d]", con->screen_size->width, con->screen_size->height);
@@ -381,6 +382,8 @@ void connect_destroy(Connection *con)
xcb_errors_context_free(con->errors);
xcb_xrm_database_free(con->database);
xcb_disconnect(con->connection);
+
+ g_free(con->info_reply);
g_free(con);
}
diff --git a/src/connect.h b/src/connect.h
index 35ed3d3..2428819 100644
--- a/src/connect.h
+++ b/src/connect.h
@@ -17,6 +17,7 @@ typedef struct Connection Connection;
struct Connection {
xcb_connection_t *connection;
xcb_screen_t *screen;
+ xcb_randr_get_screen_info_reply_t *info_reply;
xcb_randr_screen_size_t *screen_size;
double screen_dpi;
int screen_depth;
diff --git a/src/dwm.c b/src/dwm.c
index 87d794e..a1f1010 100644
--- a/src/dwm.c
+++ b/src/dwm.c
@@ -335,6 +335,7 @@ static gboolean socket_callback(GSocket *socket, GIOCondition condition, gpointe
//log_debug("Received dwm ipc response: %s", reply);
ipc_handle(data, msg_type, reply, reply_size);
+ g_free(reply);
return G_SOURCE_CONTINUE;
}
@@ -378,6 +379,7 @@ DwmIpc *dwm_create(State *state, const char *socket)
g_source_attach(dwm->source, NULL);
log_info("Attached dwm ipc source [socket=%s]", socket);
+ g_object_unref(addr);
return dwm;
}
@@ -433,6 +435,10 @@ void dwm_destroy(DwmIpc *dwm)
g_source_destroy(dwm->source);
g_source_unref(dwm->source);
g_object_unref(dwm->socket);
+
+ if (dwm->hidden_title)
+ button_destroy(dwm->title);
+
g_free(dwm);
}
diff --git a/src/state.c b/src/state.c
index d0e2e12..880c8ff 100644
--- a/src/state.c
+++ b/src/state.c
@@ -126,7 +126,7 @@ void state_request_animation(State *state)
void state_destroy(State *state)
{
- g_list_free_full(state->btns, (void *)button_destroy);
+ g_list_free_full(state->btns, (GDestroyNotify)button_destroy);
g_free(state);
}
diff --git a/src/window.c b/src/window.c
index 360f0d5..87779ea 100644
--- a/src/window.c
+++ b/src/window.c
@@ -30,7 +30,7 @@ static xcb_atom_t intern_atom(Window *win, const char *atom)
static void wm_set_size(Window *win)
{
- xcb_size_hints_t hints;
+ xcb_size_hints_t hints = { 0 };
xcb_icccm_size_hints_set_size(&hints, false, win->width, win->height);
xcb_icccm_size_hints_set_min_size(&hints, win->width, win->height);
xcb_icccm_size_hints_set_max_size(&hints, win->width, win->height);
@@ -38,7 +38,7 @@ static void wm_set_size(Window *win)
xcb_icccm_size_hints_set_position(&hints, false, win->x, win->y);
xcb_icccm_set_wm_size_hints(win->con->connection, win->window, XCB_ATOM_WM_NORMAL_HINTS, &hints);
- log_debug("Xcb icccm updated size hints");
+ log_debug("Xcb icccm size hints updated");
}
static void wm_set_struts(Window *win)
@@ -293,7 +293,6 @@ void window_destroy(Window *win)
{
cairo_destroy(win->cr);
cairo_surface_destroy(win->surface);
-
g_free(win);
}