summaryrefslogtreecommitdiff
path: root/openbox
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-08-28 19:10:36 +0000
committerDana Jansens <danakj@orodu.net>2003-08-28 19:10:36 +0000
commit700e551390a86ffdb92ddc061914ec7687658d18 (patch)
treef896dc0c68f12503e17fd13dad3615242fb7f87d /openbox
parent5baa7c802a500ee30fe9719f226d88923ee6e59d (diff)
fix a bunch of memleaks from valgrind and stuff
Diffstat (limited to 'openbox')
-rw-r--r--openbox/menu.c1
-rw-r--r--openbox/menuframe.c28
-rw-r--r--openbox/openbox.c5
-rw-r--r--openbox/prop.c1
-rw-r--r--openbox/screen.c1
5 files changed, 31 insertions, 5 deletions
diff --git a/openbox/menu.c b/openbox/menu.c
index 4ffcca0d..2847b508 100644
--- a/openbox/menu.c
+++ b/openbox/menu.c
@@ -190,6 +190,7 @@ void menu_parse()
parse_register(menu_parse_inst, "separator",
parse_menu_separator, &parse_state);
parse_tree(menu_parse_inst, doc, node->xmlChildrenNode);
+ xmlFreeDoc(doc);
}
}
diff --git a/openbox/menuframe.c b/openbox/menuframe.c
index 56dbc647..6615660d 100644
--- a/openbox/menuframe.c
+++ b/openbox/menuframe.c
@@ -170,6 +170,8 @@ void menu_frame_move_on_screen(ObMenuFrame *self)
for (f = self; f; f = f->parent)
menu_frame_move(f, f->area.x + dx, f->area.y + dy);
+ for (f = self->child; f; f = f->child)
+ menu_frame_move(f, f->area.x + dx, f->area.y + dy);
XWarpPointer(ob_display, None, None, 0, 0, 0, 0, dx, dy);
}
}
@@ -424,6 +426,11 @@ static void menu_frame_update(ObMenuFrame *self)
void menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent)
{
+ GList *it;
+
+ if (g_list_find(menu_frame_visible, self))
+ return;
+
if (parent) {
if (parent->child)
menu_frame_hide(parent->child);
@@ -437,14 +444,20 @@ void menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent)
grab_keyboard(TRUE);
}
- if (!g_list_find(menu_frame_visible, self)) {
- menu_frame_visible = g_list_prepend(menu_frame_visible, self);
-
+ /* determine if the underlying menu is already visible */
+ for (it = menu_frame_visible; it; it = g_list_next(it)) {
+ ObMenuFrame *f = it->data;
+ if (f->menu == self->menu)
+ break;
+ }
+ if (!it) {
if (self->menu->update_func)
self->menu->update_func(self, self->menu->data);
- menu_frame_update(self);
}
+ menu_frame_visible = g_list_prepend(menu_frame_visible, self);
+ menu_frame_update(self);
+
menu_frame_move_on_screen(self);
XMapWindow(ob_display, self->window);
@@ -452,7 +465,12 @@ void menu_frame_show(ObMenuFrame *self, ObMenuFrame *parent)
void menu_frame_hide(ObMenuFrame *self)
{
- menu_frame_visible = g_list_remove(menu_frame_visible, self);
+ GList *it = g_list_find(menu_frame_visible, self);
+
+ if (!it)
+ return;
+
+ menu_frame_visible = g_list_delete_link(menu_frame_visible, it);
if (self->child)
menu_frame_hide(self->child);
diff --git a/openbox/openbox.c b/openbox/openbox.c
index 165d7229..8e61fa86 100644
--- a/openbox/openbox.c
+++ b/openbox/openbox.c
@@ -235,6 +235,7 @@ int main(int argc, char **argv)
if (parse_load_rc(&doc, &node))
parse_tree(i, doc, node->xmlChildrenNode);
/* we're done with parsing now, kill it */
+ xmlFreeDoc(doc);
parse_shutdown(i);
menu_parse();
@@ -291,6 +292,10 @@ int main(int argc, char **argv)
session_shutdown();
g_free(ob_sm_id);
+#ifdef USE_LIBSN
+ sn_display_unref(ob_sn_display);
+#endif
+
XCloseDisplay(ob_display);
if (restart) {
diff --git a/openbox/prop.c b/openbox/prop.c
index 186cc133..b3349e32 100644
--- a/openbox/prop.c
+++ b/openbox/prop.c
@@ -392,6 +392,7 @@ void prop_set_strings_utf8(Window win, Atom prop, char **strs)
}
XChangeProperty(ob_display, win, prop, prop_atoms.utf8, 8,
PropModeReplace, (guchar*)str->str, str->len);
+ g_string_free(str, TRUE);
}
void prop_erase(Window win, Atom prop)
diff --git a/openbox/screen.c b/openbox/screen.c
index ac0889bf..f80f0c2d 100644
--- a/openbox/screen.c
+++ b/openbox/screen.c
@@ -67,6 +67,7 @@ static gboolean replace_wm()
wm_sn = g_strdup_printf("WM_S%d", ob_screen);
wm_sn_atom = XInternAtom(ob_display, wm_sn, FALSE);
+ g_free(wm_sn);
current_wm_sn_owner = XGetSelectionOwner(ob_display, wm_sn_atom);
if (current_wm_sn_owner) {