Index: themekey_build.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/themekey/themekey_build.inc,v
retrieving revision 1.13.2.16
diff -u -r1.13.2.16 themekey_build.inc
--- themekey_build.inc	6 Jan 2010 16:24:25 -0000	1.13.2.16
+++ themekey_build.inc	6 Jan 2010 19:18:26 -0000
@@ -326,8 +326,11 @@
   }
 
   if (empty($item['id'])) {
-    // new entry should be added at the end of the chain
+    // prevent table lock issues with drupal_write_record
+    // see http://drupal.org/node/372308#comment-2442664
+    drupal_get_schema(FALSE);
     db_lock_table('themekey_properties');
+    // new entry should be added at the end of the chain
     $weight = db_result(db_query("SELECT MAX(weight) FROM {themekey_properties}"));
     // if query fails $weight will be FALSE which will cause $item['weight'] to be set to '1'
     $item['weight'] = 1 + $weight;
