summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 01:51:33 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 01:51:33 +0000
commit70853b00ae4f3a0b3c96978cfa4a5caeabacb60b (patch)
tree0963c7a0aeb351e66f7ece5f1ac52ec8be9f8667 /chrome/common
parent7bf54f5ec74d9d3b3498c02b83da572a78fc1df6 (diff)
downloadchromium_src-70853b00ae4f3a0b3c96978cfa4a5caeabacb60b.zip
chromium_src-70853b00ae4f3a0b3c96978cfa4a5caeabacb60b.tar.gz
chromium_src-70853b00ae4f3a0b3c96978cfa4a5caeabacb60b.tar.bz2
Linux: fix crash in PopulateCookieDetails called by OnSelectionChanged callback
which can be called while the view and model are in inconsistent states. BUG=25535 TEST=open cookies manager, select all, remove all Review URL: http://codereview.chromium.org/334001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/gtk_tree.cc4
-rw-r--r--chrome/common/gtk_tree.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/chrome/common/gtk_tree.cc b/chrome/common/gtk_tree.cc
index 6bca98b..de9df51 100644
--- a/chrome/common/gtk_tree.cc
+++ b/chrome/common/gtk_tree.cc
@@ -80,6 +80,7 @@ void ModelAdapter::AddNodeToList(int row) {
}
void ModelAdapter::OnModelChanged() {
+ delegate_->OnAnyModelUpdateStart();
gtk_list_store_clear(list_store_);
delegate_->OnModelChanged();
for (int i = 0; i < table_model_->RowCount(); ++i)
@@ -88,6 +89,7 @@ void ModelAdapter::OnModelChanged() {
}
void ModelAdapter::OnItemsChanged(int start, int length) {
+ delegate_->OnAnyModelUpdateStart();
GtkTreeIter iter;
bool rv = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(list_store_), &iter,
NULL, start);
@@ -103,6 +105,7 @@ void ModelAdapter::OnItemsChanged(int start, int length) {
}
void ModelAdapter::OnItemsAdded(int start, int length) {
+ delegate_->OnAnyModelUpdateStart();
for (int i = 0; i < length; ++i) {
AddNodeToList(start + i);
}
@@ -110,6 +113,7 @@ void ModelAdapter::OnItemsAdded(int start, int length) {
}
void ModelAdapter::OnItemsRemoved(int start, int length) {
+ delegate_->OnAnyModelUpdateStart();
GtkTreeIter iter;
bool rv = gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(list_store_), &iter,
NULL, start);
diff --git a/chrome/common/gtk_tree.h b/chrome/common/gtk_tree.h
index 8caa64c..e0f7ba8 100644
--- a/chrome/common/gtk_tree.h
+++ b/chrome/common/gtk_tree.h
@@ -36,6 +36,9 @@ class ModelAdapter : public TableModelObserver {
// Should fill in the column and row.
virtual void SetColumnValues(int row, GtkTreeIter* iter) = 0;
+ // Called before any change to the TableModel. Overriding optional.
+ virtual void OnAnyModelUpdateStart() {}
+
// Called after any change to the TableModel. Overriding optional.
virtual void OnAnyModelUpdate() {}