all repos — fluxbox @ 158b515e21f0f0154041cd5985ec38fe37c0e875

custom fork of the fluxbox windowmanager

address some memory issues shown up with valgrind
rathnor rathnor
commit

158b515e21f0f0154041cd5985ec38fe37c0e875

parent

bb1a7c92d8bb194e7e415f4348b7428f1b8ef436

M ChangeLogChangeLog

@@ -1,6 +1,10 @@

(Format: Year/Month/Day) Changes for 0.9.6: *03/10/02: + * Fix couple of memory leaks and uninitialised uses shown up with + valgrind (Simon) + EventManager.cc TextureRender.cc Gnome.cc Screen.cc Window.cc + WinClient.cc Xutil.cc main.cc * Make grips children of handle (Simon) - Fixes parentrelative grip texture FbWinFrame.hh/cc
M src/FbTk/EventManager.ccsrc/FbTk/EventManager.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: EventManager.cc,v 1.8 2003/08/27 00:21:54 fluxgen Exp $ +// $Id: EventManager.cc,v 1.9 2003/10/02 16:14:41 rathnor Exp $ #include "EventManager.hh" #include "FbWindow.hh"

@@ -114,19 +114,18 @@ // dispatch event

Window root, parent_win, *children = 0; unsigned int num_children; if (XQueryTree(FbTk::App::instance()->display(), win, - &root, &parent_win, &children, &num_children) != 0 && - parent_win != 0 && - parent_win != root) { - - if (children != 0) + &root, &parent_win, &children, &num_children) != 0) { + if (children != 0) XFree(children); - if (m_parent[parent_win] == 0) - return; + if (parent_win != 0 && + parent_win != root) { + if (m_parent[parent_win] == 0) + return; - // dispatch event to parent - dispatch(parent_win, ev, true); - + // dispatch event to parent + dispatch(parent_win, ev, true); + } } }
M src/FbTk/TextureRender.ccsrc/FbTk/TextureRender.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: TextureRender.cc,v 1.4 2003/08/12 11:44:41 fluxgen Exp $ +// $Id: TextureRender.cc,v 1.5 2003/10/02 16:14:41 rathnor Exp $ #include "TextureRender.hh"

@@ -57,7 +57,7 @@ cerr<<"TextureRender: Warning! Height > 3200 setting Height = 3200"<<endl;

height = 3200; } - red = new (nothrow) unsigned char[width * height]; + red = new unsigned char[width * height]; if (red == 0) { char sbuf[128]; sprintf(sbuf, "%d", width*height);

@@ -65,14 +65,14 @@ throw string("TextureRender::TextureRender(): Out of memory while allocating red buffer."+ string(sbuf));

} - green = new (nothrow) unsigned char[width * height]; + green = new unsigned char[width * height]; if (green == 0) { char sbuf[128]; sprintf(sbuf, "%d", width*height); throw string("TextureRender::TextureRender(): Out of memory while allocating green buffer. size " + string(sbuf)); } - blue = new (nothrow) unsigned char[width * height]; + blue = new unsigned char[width * height]; if (blue == 0) { char sbuf[128]; sprintf(sbuf, "%d", width*height);
M src/Gnome.ccsrc/Gnome.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Gnome.cc,v 1.31 2003/07/28 15:06:33 rathnor Exp $ +// $Id: Gnome.cc,v 1.32 2003/10/02 16:14:41 rathnor Exp $ #include "Gnome.hh"

@@ -147,7 +147,7 @@ for (; win_it != win_it_end; ++win_it)

num += (*win_it)->numClients(); } - Window *wl = new (nothrow) Window[num]; + Window *wl = new Window[num]; if (wl == 0) { cerr<<"Fatal: Out of memory, can't allocate ("<<num*sizeof (Window)<<") for gnome client list"<<endl; return;
M src/Screen.ccsrc/Screen.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.235 2003/09/29 12:53:58 rathnor Exp $ +// $Id: Screen.cc,v 1.236 2003/10/02 16:14:41 rathnor Exp $ #include "Screen.hh"

@@ -731,7 +731,10 @@

void BScreen::removeClient(WinClient &client) { - WinClient *cyc = *cycling_window; + WinClient *cyc = 0; + if (cycling_window != focused_list.end()) + cyc = *cycling_window; + WinClient *focused = Fluxbox::instance()->getFocusedWindow(); focused_list.remove(&client); if (cyc == &client) {
M src/WinClient.ccsrc/WinClient.cc

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WinClient.cc,v 1.28 2003/09/29 14:58:15 rathnor Exp $ +// $Id: WinClient.cc,v 1.29 2003/10/02 16:14:41 rathnor Exp $ #include "WinClient.hh"

@@ -61,7 +61,8 @@ m_class_name(""), m_instance_name(""),

m_blackbox_hint(0), m_mwm_hint(0), m_focus_mode(F_PASSIVE), - m_diesig(*this), m_screen(screen) { + m_diesig(*this), m_screen(screen), + m_strut(0) { updateBlackboxHints(); updateMWMHints(); updateWMHints();
M src/Window.ccsrc/Window.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.237 2003/09/29 15:00:06 rathnor Exp $ +// $Id: Window.cc,v 1.238 2003/10/02 16:14:41 rathnor Exp $ #include "Window.hh"

@@ -1126,6 +1126,11 @@ sendConfigureNotify();

} shape(); + + if (!moving) { + m_last_resize_x = new_x; + m_last_resize_y = new_y; + } } // returns whether the focus was "set" to this window
M src/Xutil.ccsrc/Xutil.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Xutil.cc,v 1.1 2003/06/22 12:23:57 fluxgen Exp $ +// $Id: Xutil.cc,v 1.2 2003/10/02 16:14:41 rathnor Exp $ #include "Xutil.hh"

@@ -41,6 +41,7 @@

Display *display = FbTk::App::instance()->display(); XTextProperty text_prop; + text_prop.value = 0; char **list; int num; I18n *i18n = I18n::instance();

@@ -62,6 +63,9 @@ name = text_prop.value ? (char *)text_prop.value : "";

} else name = text_prop.value ? (char *)text_prop.value : ""; + + XFree(text_prop.value); + } else { // default name name = i18n->getMessage(FBNLS::WindowSet, FBNLS::WindowUnnamed, "Unnamed");
M src/main.ccsrc/main.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: main.cc,v 1.23 2003/08/28 23:18:37 fluxgen Exp $ +// $Id: main.cc,v 1.24 2003/10/02 16:14:41 rathnor Exp $ #include "fluxbox.hh" #include "I18n.hh"

@@ -135,7 +135,7 @@ }

int main(int argc, char **argv) { - std::string session_display; + std::string session_display = ""; std::string rc_file; std::string log_filename;