From: Dana Jansens Date: Wed, 13 Jun 2007 01:58:34 +0000 (+0000) Subject: plug memory leaks from the new strut code X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=9586e3bf1482a30e29f230a1a987386fcdcec2c9;p=chaz%2Fopenbox plug memory leaks from the new strut code --- diff --git a/openbox/client.c b/openbox/client.c index 8e6e1e39..df494a9f 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1993,6 +1993,7 @@ void client_update_strut(ObClient *self) a->x, a->x + a->width - 1, a->y, a->y + a->height - 1, a->x, a->x + a->width - 1); + g_free(a); } g_free(data); } @@ -2393,6 +2394,9 @@ gboolean client_has_parent(ObClient *self) static ObStackingLayer calc_layer(ObClient *self) { ObStackingLayer l; + Rect *monitor; + + monitor = screen_physical_area_monitor(client_monitor(self)); if (self->type == OB_CLIENT_TYPE_DESKTOP) l = OB_STACKING_LAYER_DESKTOP; @@ -2406,15 +2410,15 @@ static ObStackingLayer calc_layer(ObClient *self) */ (self->decorations == 0 && !(self->max_horz && self->max_vert) && - RECT_EQUAL(self->area, - *screen_physical_area_monitor - (client_monitor(self))))) && + RECT_EQUAL(self->area, *monitor))) && (client_focused(self) || client_search_focus_tree(self))) l = OB_STACKING_LAYER_FULLSCREEN; else if (self->above) l = OB_STACKING_LAYER_ABOVE; else if (self->below) l = OB_STACKING_LAYER_BELOW; else l = OB_STACKING_LAYER_NORMAL; + g_free(monitor); + return l; } @@ -2720,6 +2724,8 @@ void client_try_configure(ObClient *self, gint *x, gint *y, gint *w, gint *h, user = FALSE; /* ignore if the client can't be moved/resized when it is fullscreening */ + + g_free(a); } else if (self->max_horz || self->max_vert) { Rect *a; guint i; diff --git a/openbox/dock.c b/openbox/dock.c index ff5b74cf..121565ac 100644 --- a/openbox/dock.c +++ b/openbox/dock.c @@ -522,6 +522,8 @@ void dock_configure() dock->h += ob_rr_theme->obwidth * 2; screen_update_areas(); + + g_free(a); } void dock_app_configure(ObDockApp *app, gint w, gint h) diff --git a/openbox/focus_cycle_popup.c b/openbox/focus_cycle_popup.c index 581fa215..463eb9be 100644 --- a/openbox/focus_cycle_popup.c +++ b/openbox/focus_cycle_popup.c @@ -433,6 +433,8 @@ static void popup_render(ObFocusCyclePopup *p, const ObClient *c) RrPaint(p->a_text, p->text, textw, texth); p->last_target = newtarget; + + g_free(screen_area); } void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows, @@ -511,6 +513,7 @@ void focus_cycle_popup_single_show(struct _ObClient *c, icon_popup_min_width(single_popup, POPUP_WIDTH); icon_popup_max_width(single_popup, MAX(a->width/3, POPUP_WIDTH)); icon_popup_text_width(single_popup, popup.maxtextw); + g_free(a); } text = popup_get_name(c); diff --git a/openbox/frame.c b/openbox/frame.c index 65d1404a..19ead3b9 100644 --- a/openbox/frame.c +++ b/openbox/frame.c @@ -1581,6 +1581,7 @@ static gboolean frame_animate_iconify(gpointer p) iconx = self->area.x + self->area.width / 2 + 32; icony = a->y + a->width; iconw = 64; + g_free(a); } else { iconx = self->client->icon_geometry.x; icony = self->client->icon_geometry.y; diff --git a/openbox/keyboard.c b/openbox/keyboard.c index 9fd38def..7780753d 100644 --- a/openbox/keyboard.c +++ b/openbox/keyboard.c @@ -103,6 +103,7 @@ static void set_curpos(KeyBindingTree *newpos) /* 1 second delay for the popup to show */ popup_delay_show(popup, G_USEC_PER_SEC, text); g_free(text); + g_free(a); } else { popup_hide(popup); } diff --git a/openbox/menuframe.c b/openbox/menuframe.c index 6b3e729b..4f5a34d8 100644 --- a/openbox/menuframe.c +++ b/openbox/menuframe.c @@ -343,6 +343,8 @@ void menu_frame_move_on_screen(ObMenuFrame *self, gint x, gint y, *dx = MAX(*dx, a->x - x); *dy = MAX(*dy, a->y - y); } + + g_free(a); } static void menu_entry_frame_render(ObMenuEntryFrame *self) @@ -888,6 +890,8 @@ static void menu_frame_update(ObMenuFrame *self) } } + g_free(a); + menu_frame_render(self); } @@ -948,8 +952,10 @@ gboolean menu_frame_show_topmenu(ObMenuFrame *self, gint x, gint y, /* find the monitor the menu is on */ for (i = 0; i < screen_num_monitors; ++i) { - Rect *a = screen_physical_area_monitor(i); - if (RECT_CONTAINS(*a, x, y)) { + Rect a = screen_physical_area_monitor(i); + gboolean contains = RECT_CONTAINS(*a, x, y); + g_free(a); + if (contains) { self->monitor = i; break; } diff --git a/openbox/place.c b/openbox/place.c index 661226ae..2d14f5bd 100644 --- a/openbox/place.c +++ b/openbox/place.c @@ -45,10 +45,12 @@ static Rect *pick_pointer_head(ObClient *c) screen_pointer_pos(&px, &py); - for (i = 0; i < screen_num_monitors; ++i) { - if (RECT_CONTAINS(*screen_physical_area_monitor(i), px, py)) { + for (i = 0; i < screen_num_monitors; ++i) { + Rect *monitor = screen_physical_area_monitor(i); + gboolean contain = RECT_CONTAINS(*monitor, px, py); + g_free(monitor); + if (contain) return screen_area_monitor(c->desktop, i, NULL); - } } g_assert_not_reached(); } @@ -111,7 +113,10 @@ static Rect **pick_head(ObClient *c) screen_pointer_pos(&px, &py); for (i = 0; i < screen_num_monitors; i++) - if (RECT_CONTAINS(*screen_physical_area_monitor(i), px, py)) { + Rect *monitor = screen_physical_area_monitor(i); + gboolean contain = RECT_CONTAINS(*monitor, px, py); + g_free(monitor); + if (contain) add_choice(choice, i); ob_debug("placement adding choice %d for mouse pointer\n", i); break; diff --git a/openbox/popup.c b/openbox/popup.c index 77f751fc..590c2946 100644 --- a/openbox/popup.c +++ b/openbox/popup.c @@ -281,6 +281,8 @@ void popup_delay_show(ObPopup *self, gulong usec, gchar *text) popup_show_timeout(self); } } + + g_free(area); } void popup_hide(ObPopup *self)