From 250288397d3270c5653c449d5564dc3cb4fdb460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 26 Oct 2009 17:23:07 +0000 Subject: [PATCH] * Somehow, I forgot to update set_port_owner() for the new team port list. * Now, killing a team shut properly cause the app_server to close the windows of that team, too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33777 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/port.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/system/kernel/port.cpp b/src/system/kernel/port.cpp index fcb05e3e17..3d217b3fce 100644 --- a/src/system/kernel/port.cpp +++ b/src/system/kernel/port.cpp @@ -1380,9 +1380,9 @@ error: status_t -set_port_owner(port_id id, team_id team) +set_port_owner(port_id id, team_id newTeamID) { - TRACE(("set_port_owner(id = %ld, team = %ld)\n", id, team)); + TRACE(("set_port_owner(id = %ld, team = %ld)\n", id, newTeamID)); if (id < 0) return B_BAD_PORT_ID; @@ -1395,16 +1395,21 @@ set_port_owner(port_id id, team_id team) TRACE(("set_port_owner: invalid port_id %ld\n", id)); return B_BAD_PORT_ID; } - if (!team_is_valid(team)) { - T(OwnerChange(sPorts[slot], team, B_BAD_TEAM_ID)); + + InterruptsSpinLocker teamLocker(gTeamSpinlock); + + struct team* team = team_get_team_struct_locked(newTeamID); + if (team == NULL) { + T(OwnerChange(sPorts[slot], newTeamID, B_BAD_TEAM_ID)); return B_BAD_TEAM_ID; } - T(OwnerChange(sPorts[slot], team, B_OK)); - // transfer ownership to other team - sPorts[slot].owner = team; + list_remove_link(&sPorts[slot].team_link); + list_add_item(&team->port_list, &sPorts[slot].team_link); + sPorts[slot].owner = newTeamID; + T(OwnerChange(sPorts[slot], newTeamID, B_OK)); return B_OK; }