summaryrefslogtreecommitdiff
path: root/src/FbTk
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/FbTk
parentbb1a7c92d8bb194e7e415f4348b7428f1b8ef436 (diff)
downloadfluxbox_lack-158b515e21f0f0154041cd5985ec38fe37c0e875.zip
fluxbox_lack-158b515e21f0f0154041cd5985ec38fe37c0e875.tar.bz2
address some memory issues shown up with valgrind
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/EventManager.cc21
-rw-r--r--src/FbTk/TextureRender.cc8
2 files changed, 14 insertions, 15 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);