Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 14001)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 14003)
@@ -854,5 +854,5 @@
      * mouseReleased() (FIXME).
      */
-    private void computeHelperLine() {
+    private synchronized void computeHelperLine() {
         if (mousePos == null) {
             // Don't draw the line.
@@ -931,5 +931,5 @@
      * uses also lastUsedNode field
      */
-    private void determineCurrentBaseNodeAndPreviousNode(Collection<OsmPrimitive> selection) {
+    private synchronized void determineCurrentBaseNodeAndPreviousNode(Collection<OsmPrimitive> selection) {
         Node selectedNode = null;
         Way selectedWay = null;
@@ -1041,5 +1041,5 @@
      * @return the current base node (can be null). If not-null, it's guaranteed the node is usable
      */
-    public Node getCurrentBaseNode() {
+    public synchronized Node getCurrentBaseNode() {
         if (currentBaseNode != null && (currentBaseNode.getDataSet() == null || !currentBaseNode.isUsable())) {
             currentBaseNode = null;
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 14001)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 14003)
@@ -265,5 +265,5 @@
 
     protected void writeUnlock(boolean locked) {
-        if (locked) {
+        if (locked && dataSet != null) {
             // It shouldn't be possible for dataset to become null because
             // method calling setDataset would need write lock which is owned by this thread
