summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-10-06 10:12:06 -0400
committerDan Winship <danw@gnome.org>2014-10-08 10:18:42 -0400
commit754a5d01f09df04ae38d884bfd8191271e14cd7e (patch)
tree69be97bb0ea36245309f59ca8230995cb86d63b9
parent4f9f33fc3506e5ee153eb910ab8b5b9b5a8f1cce (diff)
downloadNetworkManager-754a5d01f09df04ae38d884bfd8191271e14cd7e.tar.gz
tui: fix multiple route editor bugs (rh #1149175)
Fix nmtui route editor bugs introduced in 98375657.
-rw-r--r--clients/tui/nmt-route-table.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/clients/tui/nmt-route-table.c b/clients/tui/nmt-route-table.c
index f8b5e89725..023928c34f 100644
--- a/clients/tui/nmt-route-table.c
+++ b/clients/tui/nmt-route-table.c
@@ -87,10 +87,12 @@ route_list_transform_to_route (GBinding *binding,
int n = GPOINTER_TO_INT (user_data);
gpointer route;
+ if (n >= priv->routes->len)
+ return FALSE;
+
route = priv->routes->pdata[n];
- if (route)
- g_value_set_boxed (target_value, route);
- return route != NULL;
+ g_value_set_boxed (target_value, route);
+ return TRUE;
}
static gboolean
@@ -110,7 +112,10 @@ route_list_transform_from_route (GBinding *binding,
route = priv->routes->pdata[n];
routes = priv->routes;
- priv->routes = NULL;
+ if (priv->family == AF_INET)
+ priv->routes = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip4_route_unref);
+ else
+ priv->routes = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip6_route_unref);
if (route) {
if (priv->family == AF_INET)
@@ -194,13 +199,10 @@ remove_route (NmtWidgetList *list,
g_ptr_array_remove_index (priv->routes, num);
nmt_widget_list_set_length (list, priv->routes->len);
- if (priv->family == AF_INET) {
- nm_ip4_route_unref (route);
+ if (priv->family == AF_INET)
g_object_notify (table, "ip4-routes");
- } else {
- nm_ip6_route_unref (route);
+ else
g_object_notify (table, "ip6-routes");
- }
}
static void