diff options
author | Grant Gayed <grant_gayed@ca.ibm.com> | 2011-12-19 15:57:38 -0500 |
---|---|---|
committer | Grant Gayed <grant_gayed@ca.ibm.com> | 2011-12-19 15:58:54 -0500 |
commit | 56cf18cd467bb60db4df938039f634ae45346298 (patch) | |
tree | 5db3e260c79a692700037ecdf0af43d98f39293b | |
parent | d6bd55e488730f8f966054d0eb048eea308ce3ad (diff) | |
download | eclipse.platform.swt-56cf18cd467bb60db4df938039f634ae45346298.tar.gz eclipse.platform.swt-56cf18cd467bb60db4df938039f634ae45346298.tar.xz eclipse.platform.swt-56cf18cd467bb60db4df938039f634ae45346298.zip |
Bug 367120 - gtk_tree_selection_get_selected_rows() invocations are
leaking
5 files changed, 20 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java index b3656bb1da..dc77be2cf6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragSourceEffect.java @@ -99,7 +99,8 @@ public class TableDragSourceEffect extends DragSourceEffect { if (count == 1) { int /*long*/ path = OS.g_list_nth_data (list, 0); int /*long*/ pixmap = OS.gtk_tree_view_create_row_drag_icon(handle, path); - dragSourceImage = Image.gtk_new(display, SWT.ICON, pixmap, 0); + dragSourceImage = Image.gtk_new(display, SWT.ICON, pixmap, 0); + OS.gtk_tree_path_free (path); } else { int width = 0, height = 0; int[] w = new int[1], h = new int[1]; @@ -115,6 +116,7 @@ public class TableDragSourceEffect extends DragSourceEffect { height = rect.y + h[0] - yy[0]; yy[i] = rect.y; hh[i] = h[0]; + OS.gtk_tree_path_free (path); } int /*long*/ source = OS.gdk_pixmap_new(OS.GDK_ROOT_PARENT(), width, height, -1); int /*long*/ gcSource = OS.gdk_gc_new(source); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java index f6e0067a4a..586fb56338 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragSourceEffect.java @@ -98,7 +98,8 @@ public class TreeDragSourceEffect extends DragSourceEffect { if (count == 1) { int /*long*/ path = OS.g_list_nth_data (list, 0); int /*long*/ pixmap = OS.gtk_tree_view_create_row_drag_icon(handle, path); - dragSourceImage = Image.gtk_new(display, SWT.ICON, pixmap, 0); + dragSourceImage = Image.gtk_new(display, SWT.ICON, pixmap, 0); + OS.gtk_tree_path_free (path); } else { int width = 0, height = 0; int[] w = new int[1], h = new int[1]; @@ -114,6 +115,7 @@ public class TreeDragSourceEffect extends DragSourceEffect { height = rect.y + h[0] - yy[0]; yy[i] = rect.y; hh[i] = h[0]; + OS.gtk_tree_path_free (path); } int /*long*/ source = OS.gdk_pixmap_new(OS.GDK_ROOT_PARENT(), width, height, -1); int /*long*/ gcSource = OS.gdk_gc_new(source); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java index c382a04297..7c475acee0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java @@ -621,8 +621,13 @@ public int getSelectionIndex () { for (int i=0; i<count; i++) { int /*long*/ data = OS.g_list_nth_data (list, i); int /*long*/ indices = OS.gtk_tree_path_get_indices (data); + OS.gtk_tree_path_free (data); if (indices != 0) { OS.memmove (index, indices, 4); + for (int j = i + 1; j < count; j++) { + data = OS.g_list_nth_data (list, j); + OS.gtk_tree_path_free (data); + } break; } } @@ -675,6 +680,7 @@ public int [] getSelectionIndices () { for (int i=0; i<count; i++) { int /*long*/ data = OS.g_list_nth_data (list, i); int /*long*/ indices = OS.gtk_tree_path_get_indices (data); + OS.gtk_tree_path_free (data); if (indices != 0) { int [] index = new int [1]; OS.memmove (index, indices, 4); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index 26bf464ea9..a6ee89d464 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -1671,6 +1671,7 @@ public TableItem [] getSelection () { for (int i=0; i<count; i++) { int /*long*/ data = OS.g_list_nth_data (list, i); int /*long*/ indices = OS.gtk_tree_path_get_indices (data); + OS.gtk_tree_path_free (data); if (indices != 0) { int [] index = new int [1]; OS.memmove (index, indices, 4); @@ -1743,8 +1744,13 @@ public int getSelectionIndex () { for (int i=0; i<count; i++) { int /*long*/ data = OS.g_list_nth_data (list, i); int /*long*/ indices = OS.gtk_tree_path_get_indices (data); + OS.gtk_tree_path_free (data); if (indices != 0) { OS.memmove (index, indices, 4); + for (int j = i + 1; j < count; j++) { + data = OS.g_list_nth_data (list, j); + OS.gtk_tree_path_free (data); + } break; } } @@ -1796,6 +1802,7 @@ public int [] getSelectionIndices () { for (int i=0; i<count; i++) { int /*long*/ data = OS.g_list_nth_data (list, i); int /*long*/ indices = OS.gtk_tree_path_get_indices (data); + OS.gtk_tree_path_free (data); if (indices != 0) { int [] index = new int [1]; OS.memmove (index, indices, 4); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index 79604337ff..c19f7ccf64 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -1774,6 +1774,7 @@ public TreeItem[] getSelection () { length++; } OS.g_free (iter); + OS.gtk_tree_path_free (data); } OS.g_list_free (list); if (length < count) { |