Unverified 提交 f12addc2 authored 作者: Andrei Tokar's avatar Andrei Tokar 提交者: GitHub

Merge pull request #1698 from h2database/test-crash-api-npe

TestCrashAPI-NPE
...@@ -1082,10 +1082,12 @@ public class Database implements DataHandler { ...@@ -1082,10 +1082,12 @@ public class Database implements DataHandler {
* @param session the session * @param session the session
*/ */
public void unlockMeta(Session session) { public void unlockMeta(Session session) {
if (meta != null) {
unlockMetaDebug(session); unlockMetaDebug(session);
meta.unlock(session); meta.unlock(session);
session.unlock(meta); session.unlock(meta);
} }
}
/** /**
* This method doesn't actually unlock the metadata table, all it does it * This method doesn't actually unlock the metadata table, all it does it
...@@ -1888,7 +1890,7 @@ public class Database implements DataHandler { ...@@ -1888,7 +1890,7 @@ public class Database implements DataHandler {
} }
} }
} else { } else {
lockMeta(session); boolean metaWasLocked = lockMeta(session);
synchronized (this) { synchronized (this) {
int id = obj.getId(); int id = obj.getId();
removeMeta(session, id); removeMeta(session, id);
...@@ -1898,6 +1900,9 @@ public class Database implements DataHandler { ...@@ -1898,6 +1900,9 @@ public class Database implements DataHandler {
objectIds.set(id); objectIds.set(id);
} }
} }
if (!metaWasLocked) {
unlockMeta(session);
}
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论