aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-10-02 16:14:41 (GMT)
committerrathnor <rathnor>2003-10-02 16:14:41 (GMT)
commit158b515e21f0f0154041cd5985ec38fe37c0e875 (patch)
treec1aebd425cef8610820043ae1f380dd5fb1f02d1 /src
parentbb1a7c92d8bb194e7e415f4348b7428f1b8ef436 (diff)
downloadfluxbox-158b515e21f0f0154041cd5985ec38fe37c0e875.zip
fluxbox-158b515e21f0f0154041cd5985ec38fe37c0e875.tar.bz2
address some memory issues shown up with valgrind
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/EventManager.cc21
-rw-r--r--src/FbTk/TextureRender.cc8
-rw-r--r--src/Gnome.cc4
-rw-r--r--src/Screen.cc7
-rw-r--r--src/WinClient.cc5
-rw-r--r--src/Window.cc7
-rw-r--r--src/Xutil.cc6
-rw-r--r--src/main.cc4
8 files changed, 37 insertions, 25 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc
index eadc701..ff01794 100644
--- a/src/FbTk/EventManager.cc
+++ b/src/FbTk/EventManager.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: EventManager.cc,v 1.8 2003/08/27 00:21:54 fluxgen Exp $ 22// $Id: EventManager.cc,v 1.9 2003/10/02 16:14:41 rathnor Exp $
23 23
24#include "EventManager.hh" 24#include "EventManager.hh"
25#include "FbWindow.hh" 25#include "FbWindow.hh"
@@ -114,19 +114,18 @@ void EventManager::dispatch(Window win, XEvent &ev, bool parent) {
114 Window root, parent_win, *children = 0; 114 Window root, parent_win, *children = 0;
115 unsigned int num_children; 115 unsigned int num_children;
116 if (XQueryTree(FbTk::App::instance()->display(), win, 116 if (XQueryTree(FbTk::App::instance()->display(), win,
117 &root, &parent_win, &children, &num_children) != 0 && 117 &root, &parent_win, &children, &num_children) != 0) {
118 parent_win != 0 && 118 if (children != 0)
119 parent_win != root) {
120
121 if (children != 0)
122 XFree(children); 119 XFree(children);
123 120
124 if (m_parent[parent_win] == 0) 121 if (parent_win != 0 &&
125 return; 122 parent_win != root) {
126 123 if (m_parent[parent_win] == 0)
127 // dispatch event to parent 124 return;
128 dispatch(parent_win, ev, true);
129 125
126 // dispatch event to parent
127 dispatch(parent_win, ev, true);
128 }
130 } 129 }
131 130
132} 131}
diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc
index 40a7e72..f1f1103 100644
--- a/src/FbTk/TextureRender.cc
+++ b/src/FbTk/TextureRender.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: TextureRender.cc,v 1.4 2003/08/12 11:44:41 fluxgen Exp $ 25// $Id: TextureRender.cc,v 1.5 2003/10/02 16:14:41 rathnor Exp $
26 26
27#include "TextureRender.hh" 27#include "TextureRender.hh"
28 28
@@ -57,7 +57,7 @@ TextureRender::TextureRender(ImageControl &imgctrl,
57 height = 3200; 57 height = 3200;
58 } 58 }
59 59
60 red = new (nothrow) unsigned char[width * height]; 60 red = new unsigned char[width * height];
61 if (red == 0) { 61 if (red == 0) {
62 char sbuf[128]; 62 char sbuf[128];
63 sprintf(sbuf, "%d", width*height); 63 sprintf(sbuf, "%d", width*height);
@@ -65,14 +65,14 @@ TextureRender::TextureRender(ImageControl &imgctrl,
65 } 65 }
66 66
67 67
68 green = new (nothrow) unsigned char[width * height]; 68 green = new unsigned char[width * height];
69 if (green == 0) { 69 if (green == 0) {
70 char sbuf[128]; 70 char sbuf[128];
71 sprintf(sbuf, "%d", width*height); 71 sprintf(sbuf, "%d", width*height);
72 throw string("TextureRender::TextureRender(): Out of memory while allocating green buffer. size " + string(sbuf)); 72 throw string("TextureRender::TextureRender(): Out of memory while allocating green buffer. size " + string(sbuf));
73 } 73 }
74 74
75 blue = new (nothrow) unsigned char[width * height]; 75 blue = new unsigned char[width * height];
76 if (blue == 0) { 76 if (blue == 0) {
77 char sbuf[128]; 77 char sbuf[128];
78 sprintf(sbuf, "%d", width*height); 78 sprintf(sbuf, "%d", width*height);
diff --git a/src/Gnome.cc b/src/Gnome.cc
index 2059839..86f7f75 100644
--- a/src/Gnome.cc
+++ b/src/Gnome.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Gnome.cc,v 1.31 2003/07/28 15:06:33 rathnor Exp $ 22// $Id: Gnome.cc,v 1.32 2003/10/02 16:14:41 rathnor Exp $
23 23
24#include "Gnome.hh" 24#include "Gnome.hh"
25 25
@@ -147,7 +147,7 @@ void Gnome::updateClientList(BScreen &screen) {
147 num += (*win_it)->numClients(); 147 num += (*win_it)->numClients();
148 } 148 }
149 149
150 Window *wl = new (nothrow) Window[num]; 150 Window *wl = new Window[num];
151 if (wl == 0) { 151 if (wl == 0) {
152 cerr<<"Fatal: Out of memory, can't allocate ("<<num*sizeof (Window)<<") for gnome client list"<<endl; 152 cerr<<"Fatal: Out of memory, can't allocate ("<<num*sizeof (Window)<<") for gnome client list"<<endl;
153 return; 153 return;
diff --git a/src/Screen.cc b/src/Screen.cc
index f2466e3..487f0c0 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Screen.cc,v 1.235 2003/09/29 12:53:58 rathnor Exp $ 25// $Id: Screen.cc,v 1.236 2003/10/02 16:14:41 rathnor Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -731,7 +731,10 @@ void BScreen::removeWindow(FluxboxWindow *win) {
731 731
732void BScreen::removeClient(WinClient &client) { 732void BScreen::removeClient(WinClient &client) {
733 733
734 WinClient *cyc = *cycling_window; 734 WinClient *cyc = 0;
735 if (cycling_window != focused_list.end())
736 cyc = *cycling_window;
737
735 WinClient *focused = Fluxbox::instance()->getFocusedWindow(); 738 WinClient *focused = Fluxbox::instance()->getFocusedWindow();
736 focused_list.remove(&client); 739 focused_list.remove(&client);
737 if (cyc == &client) { 740 if (cyc == &client) {
diff --git a/src/WinClient.cc b/src/WinClient.cc
index e032304..dadabe3 100644
--- a/src/WinClient.cc
+++ b/src/WinClient.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: WinClient.cc,v 1.28 2003/09/29 14:58:15 rathnor Exp $ 22// $Id: WinClient.cc,v 1.29 2003/10/02 16:14:41 rathnor Exp $
23 23
24#include "WinClient.hh" 24#include "WinClient.hh"
25 25
@@ -61,7 +61,8 @@ WinClient::WinClient(Window win, BScreen &screen, FluxboxWindow *fbwin):FbTk::Fb
61 m_blackbox_hint(0), 61 m_blackbox_hint(0),
62 m_mwm_hint(0), 62 m_mwm_hint(0),
63 m_focus_mode(F_PASSIVE), 63 m_focus_mode(F_PASSIVE),
64 m_diesig(*this), m_screen(screen) { 64 m_diesig(*this), m_screen(screen),
65 m_strut(0) {
65 updateBlackboxHints(); 66 updateBlackboxHints();
66 updateMWMHints(); 67 updateMWMHints();
67 updateWMHints(); 68 updateWMHints();
diff --git a/src/Window.cc b/src/Window.cc
index 8609861..47fe00c 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.237 2003/09/29 15:00:06 rathnor Exp $ 25// $Id: Window.cc,v 1.238 2003/10/02 16:14:41 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -1126,6 +1126,11 @@ void FluxboxWindow::moveResize(int new_x, int new_y,
1126 } 1126 }
1127 1127
1128 shape(); 1128 shape();
1129
1130 if (!moving) {
1131 m_last_resize_x = new_x;
1132 m_last_resize_y = new_y;
1133 }
1129} 1134}
1130 1135
1131// returns whether the focus was "set" to this window 1136// returns whether the focus was "set" to this window
diff --git a/src/Xutil.cc b/src/Xutil.cc
index 5203469..671c52e 100644
--- a/src/Xutil.cc
+++ b/src/Xutil.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: Xutil.cc,v 1.1 2003/06/22 12:23:57 fluxgen Exp $ 23// $Id: Xutil.cc,v 1.2 2003/10/02 16:14:41 rathnor Exp $
24 24
25#include "Xutil.hh" 25#include "Xutil.hh"
26 26
@@ -41,6 +41,7 @@ std::string getWMName(Window window) {
41 Display *display = FbTk::App::instance()->display(); 41 Display *display = FbTk::App::instance()->display();
42 42
43 XTextProperty text_prop; 43 XTextProperty text_prop;
44 text_prop.value = 0;
44 char **list; 45 char **list;
45 int num; 46 int num;
46 I18n *i18n = I18n::instance(); 47 I18n *i18n = I18n::instance();
@@ -62,6 +63,9 @@ std::string getWMName(Window window) {
62 63
63 } else 64 } else
64 name = text_prop.value ? (char *)text_prop.value : ""; 65 name = text_prop.value ? (char *)text_prop.value : "";
66
67 XFree(text_prop.value);
68
65 } else { // default name 69 } else { // default name
66 name = i18n->getMessage(FBNLS::WindowSet, FBNLS::WindowUnnamed, 70 name = i18n->getMessage(FBNLS::WindowSet, FBNLS::WindowUnnamed,
67 "Unnamed"); 71 "Unnamed");
diff --git a/src/main.cc b/src/main.cc
index c3bc73a..9a91e35 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: main.cc,v 1.23 2003/08/28 23:18:37 fluxgen Exp $ 23// $Id: main.cc,v 1.24 2003/10/02 16:14:41 rathnor Exp $
24 24
25#include "fluxbox.hh" 25#include "fluxbox.hh"
26#include "I18n.hh" 26#include "I18n.hh"
@@ -135,7 +135,7 @@ void showInfo(ostream &ostr) {
135 135
136int main(int argc, char **argv) { 136int main(int argc, char **argv) {
137 137
138 std::string session_display; 138 std::string session_display = "";
139 std::string rc_file; 139 std::string rc_file;
140 std::string log_filename; 140 std::string log_filename;
141 141