Re: [evolution-patches] patch for #73787 (shared-folder plugin)
- From: Vivek Jain <jvivek novell com>
- To: Not Zed <notzed ximian com>
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] patch for #73787 (shared-folder plugin)
- Date: Mon, 21 Mar 2005 10:22:03 +0530
hi,
sending the patch again with the suggested changes. (freeing path)
I've also included some NULL checks.
Thanks,
vivek
On Mon, 2005-03-21 at 11:40 +0800, Not Zed wrote:
>
> doesn't this leak the path?
>
> On Sun, 2005-03-20 at 17:34 +0530, Vivek Jain wrote:
> > hi,
> >
> > the attached patch fixes
> > https://bugzilla.innerweb.novell.com/show_bug.cgi?id=73787&x=0&y=0
> >
> > the changes are made in plugins/shared-folder/share-folder.c
> >
> > Thanks,
> >
> > Vivek Jain
> >
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/plugins/shared-folder/ChangeLog,v
retrieving revision 1.12
diff -u -p -r1.12 ChangeLog
--- ChangeLog 10 Mar 2005 09:19:48 -0000 1.12
+++ ChangeLog 21 Mar 2005 04:48:12 -0000
@@ -1,3 +1,13 @@
+2005-03-20 Vivek Jain <jvivek novell com>
+
+ **Fixes #73787 (bugzilla innerweb.novell)
+ * share-folder.c :
+ (add_right_clicked)
+ (edit_right_clicked)
+ (delete_right_clicked) : use path passed in the callback to get the
+ current iterator
+ also including some NULL checks
+
2005-03-10 Vivek Jain <jvivek novell com>
**Fixes #73201
Index: share-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/plugins/shared-folder/share-folder.c,v
retrieving revision 1.7
diff -u -p -r1.7 share-folder.c
--- share-folder.c 24 Jan 2005 14:52:32 -0000 1.7
+++ share-folder.c 21 Mar 2005 04:48:13 -0000
@@ -565,14 +565,19 @@ add_right_clicked (GtkCellRenderer *rend
SharedUser *usr = NULL;
EShUsers *user = NULL;
char *email = NULL;
- GtkTreeSelection *selection = NULL;
- selection = gtk_tree_view_get_selection(GTK_TREE_VIEW (sf->user_list));
- gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
- if (! gtk_tree_selection_get_selected (selection, &(sf->model), &(sf->iter)));
+ GtkTreePath *path = NULL;
+
+ path = gtk_tree_path_new_from_string (arg1);
+ if (!gtk_tree_model_get_iter ((GtkTreeModel *) sf->model, &(sf->iter), path)){
+ gtk_tree_path_free (path);
+ return ;
+ }
gtk_tree_model_get ((GtkTreeModel *) sf->model, &(sf->iter), 0, &email, 1, &right , -1);
usr = find_node(sf->users_list, email);
- if (!usr)
- return ;
+ if (!usr) {
+ gtk_tree_path_free (path);
+ return;
+ }
if(! usr->flag) /* if user was already existing one change the flag to update*/
usr->flag = usr->flag | 0x2;
user = usr->user_node;
@@ -583,7 +588,7 @@ add_right_clicked (GtkCellRenderer *rend
user->rights &= 0x6;
gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 1, FALSE, -1);
}
-
+ gtk_tree_path_free (path);
}
static void
@@ -593,8 +598,19 @@ edit_right_clicked(GtkCellRenderer *rend
SharedUser *usr = NULL;
EShUsers *user = NULL;
char *email = NULL;
+ GtkTreePath *path = NULL;
+
+ path = gtk_tree_path_new_from_string (arg1);
+ if (!gtk_tree_model_get_iter ((GtkTreeModel *) sf->model, &(sf->iter), path)) {
+ gtk_tree_path_free (path);
+ return;
+ }
gtk_tree_model_get ((GtkTreeModel *) sf->model, &(sf->iter), 0, &email, 2, &right , -1);
usr = find_node(sf->users_list, email);
+ if (!usr) {
+ gtk_tree_path_free (path);
+ return;
+ }
if(! usr->flag) /* if user was already existing one change the flag to update*/
usr->flag = usr->flag | 0x2;
user = usr->user_node;
@@ -606,7 +622,7 @@ edit_right_clicked(GtkCellRenderer *rend
user->rights &= 0x5;
gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 2, FALSE, -1);
}
-
+ gtk_tree_path_free (path);
}
static void
@@ -616,8 +632,19 @@ delete_right_clicked(GtkCellRenderer *re
SharedUser *usr = NULL;
EShUsers *user = NULL;
char *email = NULL;
+ GtkTreePath *path = NULL;
+
+ path = gtk_tree_path_new_from_string (arg1);
+ if (!gtk_tree_model_get_iter ((GtkTreeModel *) sf->model, &(sf->iter), path)) {
+ gtk_tree_path_free (path);
+ return;
+ }
gtk_tree_model_get ((GtkTreeModel *) sf->model, &(sf->iter), 0, &email, 3, &right , -1);
usr = find_node(sf->users_list, email);
+ if (!usr) {
+ gtk_tree_path_free (path);
+ return;
+ }
if(! usr->flag) /* if user was already existing one change the flag to update*/
usr->flag = usr->flag | 0x2;
user = usr->user_node;
@@ -628,7 +655,7 @@ delete_right_clicked(GtkCellRenderer *re
user->rights &= 0x3;
gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 3, FALSE, -1);
}
-
+ gtk_tree_path_free (path);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]