r21853 - gnucash/trunk/src/gnome-utils - Read-only mode: Don't create a LCK file when opening a file in read-only mode and also ignore existing locks.

Christian Stimming cstim at code.gnucash.org
Sun Jan 15 17:06:23 EST 2012


Author: cstim
Date: 2012-01-15 17:06:23 -0500 (Sun, 15 Jan 2012)
New Revision: 21853
Trac: http://svn.gnucash.org/trac/changeset/21853

Modified:
   gnucash/trunk/src/gnome-utils/gnc-file.c
Log:
Read-only mode: Don't create a LCK file when opening a file in read-only mode and also ignore existing locks.

Modified: gnucash/trunk/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-file.c	2012-01-13 15:56:22 UTC (rev 21852)
+++ gnucash/trunk/src/gnome-utils/gnc-file.c	2012-01-15 22:06:23 UTC (rev 21853)
@@ -768,7 +768,8 @@
     /* but first, check to make sure we've got a session going. */
     new_session = qof_session_new ();
 
-    qof_session_begin (new_session, newfile, FALSE, FALSE, FALSE);
+    // Begin the new session. If we are in read-only mode, ignore the locks.
+    qof_session_begin (new_session, newfile, is_readonly, FALSE, FALSE);
     io_err = qof_session_get_error (new_session);
 
     if (ERR_BACKEND_BAD_URL == io_err)
@@ -853,8 +854,8 @@
             // re-enable the splash screen, file loading and display of
             // reports may take some time
             gnc_show_splash_screen();
-            /* user told us to open readonly. We do not ignore locks, but force the opening. */
-            qof_session_begin (new_session, newfile, FALSE, FALSE, TRUE);
+            /* user told us to open readonly. We do ignore locks (just as before), but now also force the opening. */
+            qof_session_begin (new_session, newfile, is_readonly, FALSE, TRUE);
             break;
         case RESPONSE_OPEN:
             // re-enable the splash screen, file loading and display of



More information about the gnucash-changes mailing list