summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Friis <peavey@placid.dk>2008-06-09 15:03:14 +0000
committerDennis Friis <peavey@placid.dk>2008-06-09 15:03:14 +0000
commiteb019ab915998a3ec247b33dad4b23f763d7a29a (patch)
tree54c4844a719942376327dac8678476524c54db6c
parent0dd4c03506132c5f4a7104152d8675d6990ba81b (diff)
downloadmana-eb019ab915998a3ec247b33dad4b23f763d7a29a.tar.gz
mana-eb019ab915998a3ec247b33dad4b23f763d7a29a.tar.bz2
mana-eb019ab915998a3ec247b33dad4b23f763d7a29a.tar.xz
mana-eb019ab915998a3ec247b33dad4b23f763d7a29a.zip
Fix for segfault in drop down list of player ignore and sanity check for /whisper ignore. Patch by fate.
-rw-r--r--ChangeLog9
-rw-r--r--src/gui/setup_players.cpp7
-rw-r--r--src/gui/table.cpp5
-rw-r--r--src/player_relations.cpp10
4 files changed, 25 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 943b7f84..90505cbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
+2008-06-08 Fate <fate.tmw@googlemail.com>
+
+ * src/gui/table.cpp: Invalidate mTopWidget whenever the model is
+ regenerated to reflect that we have no current valid selection.
+ * src/player_relations.cpp: Proper handling of case where player, to
+ apply ignore strategy to, is NULL.
+
2008-06-05 Philipp Sehmisch <tmw@crushnet.org>
* src/particle.cpp, src/gui/setup_video.cpp: Lowered default particle
- detail level.
+ detail level.
2008-06-05 Bjørn Lindeijer <bjorn@lindeijer.nl>
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index ae0e7271..20a225b8 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -320,7 +320,12 @@ Setup_Players::action(const gcn::ActionEvent &event)
player_relations.addListener(this);
} else if (event.getId() == ACTION_DELETE) {
- std::string name = mPlayerTableModel->getPlayerAt(mPlayerTable->getSelectedRow());
+ int player_index = mPlayerTable->getSelectedRow();
+
+ if (player_index < 0)
+ return;
+
+ std::string name = mPlayerTableModel->getPlayerAt(player_index);
player_relations.removePlayer(name);
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index 07f40f76..89a93825 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -109,6 +109,7 @@ GuiTable::setModel(TableModel *new_model)
recomputeDimensions();
}
+
void
GuiTable::recomputeDimensions(void)
{
@@ -347,8 +348,10 @@ GuiTable::modelUpdated(bool completed)
if (completed) {
recomputeDimensions();
installActionListeners();
- } else // before the update?
+ } else { // before the update?
+ mTopWidget = NULL; // No longer valid in general
uninstallActionListeners();
+ }
}
gcn::Widget *
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index 86e0861e..f7e04712 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -211,9 +211,13 @@ PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flag
if (!permitted) {
// execute `ignore' strategy, if possible
- if (mIgnoreStrategy)
- mIgnoreStrategy->ignore(dynamic_cast<Player *>(beingManager->findBeingByName(name, Being::PLAYER)),
- rejections);
+ if (mIgnoreStrategy) {
+ Player *to_ignore = dynamic_cast<Player *>(beingManager->findBeingByName(name, Being::PLAYER));
+
+ if (to_ignore)
+ mIgnoreStrategy->ignore(to_ignore,
+ rejections);
+ }
}
return permitted;