From bacf8229b04b9a240e2fcffa3982059560bdb2ab Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 22 Jan 2006 18:19:09 +0000 Subject: [PATCH] - release colors to avoid issues with the reference count overflowing a small integer and causing unexpected color releases that can crash Window Maker (Martin Frydl ) - fixed a small memory leak in WINGs/wview.c caused by not releasing the background color of a view (Martin Frydl ) --- ChangeLog | 5 +++++ WINGs/wview.c | 3 +++ src/switchpanel.c | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c0a0f3bb..a859107d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,11 @@ Changes since version 0.92.0: on 64bit platforms (Max Loparyev ) - fixed issue with icon colors on big endian platforms (Max Loparyev ) +- release colors to avoid issues with the reference count overflowing a + small integer and causing unexpected color releases that can crash + Window Maker (Martin Frydl ) +- fixed a small memory leak in WINGs/wview.c caused by not releasing the + background color of a view (Martin Frydl ) Changes since version 0.91.0: diff --git a/WINGs/wview.c b/WINGs/wview.c index c1ec136c..be840a9f 100644 --- a/WINGs/wview.c +++ b/WINGs/wview.c @@ -450,6 +450,9 @@ destroyView(W_View *view) W_FreeViewXdndPart(view); + if (view->backColor) + WMReleaseColor(view->backColor); + wfree(view); } diff --git a/src/switchpanel.c b/src/switchpanel.c index 51298ce4..594c141d 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -501,6 +501,7 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace) if (!panel->bg) { WMFrame *frame = WMCreateFrame(panel->win); + WMColor *darkGray = WMDarkGrayColor(scr->wmscreen); WMSetFrameRelief(frame, WRSimple); WMSetViewExpandsToParent(WMWidgetView(frame), 0, 0, 0, 0); @@ -508,10 +509,11 @@ WSwitchPanel *wInitSwitchPanel(WScreen *scr, WWindow *curwin, int workspace) WMResizeWidget(panel->label, width, LABEL_HEIGHT); WMMoveWidget(panel->label, BORDER_SPACE, BORDER_SPACE+ICON_TILE_SIZE+5); WMSetLabelRelief(panel->label, WRSimple); - WMSetWidgetBackgroundColor(panel->label, WMDarkGrayColor(scr->wmscreen)); + WMSetWidgetBackgroundColor(panel->label, darkGray); WMSetLabelFont(panel->label, panel->font); WMSetLabelTextColor(panel->label, panel->white); + WMReleaseColor(darkGray); height+= 5; } @@ -604,6 +606,8 @@ void wSwitchPanelDestroy(WSwitchPanel *panel) RReleaseImage(panel->bg); if (panel->font) WMReleaseFont(panel->font); + if (panel->white) + WMReleaseColor(panel->white); wfree(panel); } -- 2.11.4.GIT