Pass up-to-date team_info to TeamRow, so we can detect when a team app image has changed after

an exec() syscall, and update team's fields, icon included. 
This fix #7988.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42755 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2011-09-15 22:14:00 +00:00
parent b1312c5c64
commit 909c526903
2 changed files with 23 additions and 3 deletions

View File

@ -201,6 +201,21 @@ TeamRow::TeamRow(team_id team)
}
status_t
TeamRow::UpdateInfo(team_info& info)
{
// Check if we need to rebuilt the row's fields because the team critical
// info (basically, app image running under that team ID) has changed
if (info.argc != fTeamInfo.argc
|| strncmp(info.args, fTeamInfo.args, sizeof(fTeamInfo.args)) != 0) {
return _SetTo(info);
}
return B_OK;
}
status_t
TeamRow::_SetTo(team_info& info)
{
@ -427,7 +442,10 @@ TeamsListView::_UpdateList()
row = dynamic_cast<TeamRow*>(RowAt(index));
}
if (row == NULL || tmi.team != row->TeamID()) {
if (row != NULL && tmi.team == row->TeamID()) {
// The team image app could have change due after an exec*() call,
row->UpdateInfo(tmi);
} else if (row == NULL || tmi.team != row->TeamID()) {
// Team not found in previously known teams list: insert a new row
TeamRow* newRow = new(std::nothrow) TeamRow(tmi);
if (newRow != NULL) {

View File

@ -63,17 +63,19 @@ private:
class TeamRow : public BRow {
typedef BRow Inherited;
public:
TeamRow(team_info & teamInfo);
TeamRow(team_info& teamInfo);
TeamRow(team_id teamId);
public:
team_id TeamID() const { return fTeamInfo.team; }
status_t UpdateInfo(team_info& info);
virtual void SetEnabled(bool enabled) { fEnabled = enabled; }
bool IsEnabled() const { return fEnabled; }
private:
status_t _SetTo(team_info & info);
status_t _SetTo(team_info& info);
private:
bool fEnabled;