aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2001-08-28 11:25:08 +0000
committernyamatongwe <devnull@localhost>2001-08-28 11:25:08 +0000
commit3a2836b184c6871097242a26dd0cfd27010c7a52 (patch)
tree635127d20e66eab7bd2c5a51387714c4c969d733
parent6e581b90a4db82ae84e1e94ef8439dda700acb4c (diff)
downloadscintilla-mirror-3a2836b184c6871097242a26dd0cfd27010c7a52.tar.gz
Patch from john to avoid leaking memory when setting cursor.
-rw-r--r--gtk/PlatGTK.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index c09aefa04..3e2d10f99 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -640,26 +640,30 @@ void Window::SetFont(Font &) {
}
void Window::SetCursor(Cursor curs) {
+ GdkCursor *gdkCurs;
switch (curs) {
case cursorText:
- gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_XTERM));
+ gdkCurs = gdk_cursor_new(GDK_XTERM);
break;
case cursorArrow:
- gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_ARROW));
+ gdkCurs = gdk_cursor_new(GDK_ARROW);
break;
case cursorUp:
- gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_CENTER_PTR));
+ gdkCurs = gdk_cursor_new(GDK_CENTER_PTR);
break;
case cursorWait:
- gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_WATCH));
+ gdkCurs = gdk_cursor_new(GDK_WATCH);
break;
case cursorReverseArrow:
- gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_TOP_LEFT_ARROW));
+ gdkCurs = gdk_cursor_new(GDK_TOP_LEFT_ARROW);
break;
default:
- gdk_window_set_cursor(id->window, gdk_cursor_new(GDK_ARROW));
+ gdkCurs = gdk_cursor_new(GDK_ARROW);
break;
}
+
+ gdk_window_set_cursor(id->window, gdkCurs);
+ gdk_cursor_destroy(gdkCurs);
}
void Window::SetTitle(const char *s) {