All pastes #264151 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-02 02:58 UTC
rendered paste body
Index: src/gnome-utils/gnc-file.c
===================================================================
--- src/gnome-utils/gnc-file.c	(revision 15110)
+++ src/gnome-utils/gnc-file.c	(working copy)
@@ -1157,5 +1157,6 @@
 gboolean
 gnc_file_save_in_progress (void)
 {
-  return (save_in_progress > 0);
+    QofSession session = gnc_get_current_session();
+    return (session->lock || save_in_progress > 0)
 }
Index: lib/libqof/qof/qofsession.c
===================================================================
--- lib/libqof/qof/qofsession.c	(revision 15110)
+++ lib/libqof/qof/qofsession.c	(working copy)
@@ -1193,7 +1193,8 @@
 	int err;
 	gint num;
 	char *msg, *book_id;
-	
+
+        if (!session->lock) return;
 	if (!session) return;
 	ENTER ("sess=%p book_id=%s", 
 		 session, session->book_id ? session->book_id : "(null)");
@@ -1280,7 +1281,7 @@
 				p = p->next;
 			}
 		}
-		if(!session->backend) 
+		if(!session->backend)
 		{
 			msg = g_strdup_printf("failed to load backend");
 			qof_session_push_error(session, ERR_BACKEND_NO_HANDLER, msg);
@@ -1299,6 +1300,7 @@
 	be = session->backend;
 	if (be)
 	{
+		session->lock++;
 		for (node = session->books; node; node=node->next)
 		{
 			abook = node->data;
@@ -1311,6 +1313,7 @@
 				if (save_error_handler(be, session)) return;
 			}
 		}
+		session->lock--;
 		/* If we got to here, then the backend saved everything 
 		* just fine, and we are done. So return. */
 		/* Return the book_id to previous value. */