summaryrefslogtreecommitdiff
path: root/libnautilus/nautilus-undo-transaction.c
diff options
context:
space:
mode:
authorGene Z. Ragan <gzr@eazel.com>2000-08-05 19:18:55 +0000
committerGene Ragan <gzr@src.gnome.org>2000-08-05 19:18:55 +0000
commitcb36670cefe21c96ef82f5d8c5ab9160daaf862b (patch)
tree8923e649c2a9c3883759db5f9e59600e7e6ab71f /libnautilus/nautilus-undo-transaction.c
parent598ae456e3289673300fa4c4109554d7ffd847c0 (diff)
downloadnautilus-cb36670cefe21c96ef82f5d8c5ab9160daaf862b.tar.gz
Fixed a bug where transaction)in_progress was always TRUE. This caused a
2000-08-05 Gene Z. Ragan <gzr@eazel.com> * libnautilus-extensions/nautilus-undo-manager.c: (corba_append), (nautilus_undo_manager_undo): Fixed a bug where transaction)in_progress was always TRUE. This caused a g_warning to always be fired. I guess no one noticed because we aren't exercising the undo code. * libnautilus/nautilus-undo-transaction.c: (remove_transaction_from_object), (nautilus_undo_transaction_add_atom), (nautilus_undo_transaction_add_to_undo_manager), (remove_atoms_cover), (nautilus_undo_transaction_unregister_object): Fixed bug 1984, crash when closing window after an undo operation. This crash is caused by a bogus transaction being left in the target objects transaction list. An assert is thrown because the item in the list is not a transaction. I suspect it is the sad remains of an unrefed transaciton that is still in the list somehow. I made a work arund by checking before freeing, but need Darin's help to figure out the true cause.
Diffstat (limited to 'libnautilus/nautilus-undo-transaction.c')
-rw-r--r--libnautilus/nautilus-undo-transaction.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/libnautilus/nautilus-undo-transaction.c b/libnautilus/nautilus-undo-transaction.c
index 5fc84eff5..753d71c93 100644
--- a/libnautilus/nautilus-undo-transaction.c
+++ b/libnautilus/nautilus-undo-transaction.c
@@ -212,8 +212,11 @@ remove_transaction_from_object (gpointer list_data, gpointer callback_data)
/* Remove the transaction from the list on the atom. */
list = gtk_object_get_data (atom->target, NAUTILUS_UNDO_TRANSACTION_LIST_DATA);
- list = g_list_remove (list, transaction);
- gtk_object_set_data (atom->target, NAUTILUS_UNDO_TRANSACTION_LIST_DATA, list);
+
+ if (list != NULL) {
+ list = g_list_remove (list, transaction);
+ gtk_object_set_data (atom->target, NAUTILUS_UNDO_TRANSACTION_LIST_DATA, list);
+ }
}
static void
@@ -262,7 +265,7 @@ nautilus_undo_transaction_add_atom (NautilusUndoTransaction *transaction,
transaction->atom_list = g_list_append
(transaction->atom_list, g_memdup (atom, sizeof (*atom)));
- /* Add the transaction to the list on the atom. */
+ /* Add the transaction to the list on the atoms target object. */
list = gtk_object_get_data (atom->target, NAUTILUS_UNDO_TRANSACTION_LIST_DATA);
if (g_list_find (list, transaction) != NULL) {
return;
@@ -271,7 +274,7 @@ nautilus_undo_transaction_add_atom (NautilusUndoTransaction *transaction,
/* If it's not already on that atom, this object is new. */
list = g_list_prepend (list, transaction);
gtk_object_set_data (atom->target, NAUTILUS_UNDO_TRANSACTION_LIST_DATA, list);
-
+
/* Connect a signal handler to the atom so it will unregister
* itself when it's destroyed.
*/
@@ -290,8 +293,7 @@ nautilus_undo_transaction_undo (NautilusUndoTransaction *transaction)
}
void
-nautilus_undo_transaction_add_to_undo_manager (NautilusUndoTransaction *transaction,
- Nautilus_Undo_Manager manager)
+nautilus_undo_transaction_add_to_undo_manager (NautilusUndoTransaction *transaction, Nautilus_Undo_Manager manager)
{
CORBA_Environment ev;
@@ -352,7 +354,9 @@ remove_atoms (NautilusUndoTransaction *transaction,
static void
remove_atoms_cover (gpointer list_data, gpointer callback_data)
{
- remove_atoms (NAUTILUS_UNDO_TRANSACTION (list_data), GTK_OBJECT (callback_data));
+ if (NAUTILUS_IS_UNDO_TRANSACTION (list_data)) {
+ remove_atoms (NAUTILUS_UNDO_TRANSACTION (list_data), GTK_OBJECT (callback_data));
+ }
}
void
@@ -364,9 +368,11 @@ nautilus_undo_transaction_unregister_object (GtkObject *object)
/* Remove atoms from each transaction on the list. */
list = gtk_object_get_data (object, NAUTILUS_UNDO_TRANSACTION_LIST_DATA);
- g_list_foreach (list, remove_atoms_cover, object);
- g_list_free (list);
- gtk_object_remove_data (object, NAUTILUS_UNDO_TRANSACTION_LIST_DATA);
+ if (list != NULL) {
+ g_list_foreach (list, remove_atoms_cover, object);
+ g_list_free (list);
+ gtk_object_remove_data (object, NAUTILUS_UNDO_TRANSACTION_LIST_DATA);
+ }
}
static void