﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
21929	buildings_tools constantly creates new cursors causing XWayland to crash	anonymous	Upliner	"JOSM: 18389
buildings_tools: 35916

The problem is caused by buildings_tools plugin in JOSM – it generates a new cursor for every mouse movement while over the JOSM drawing area and every new cursor causes a new open file in Wayland eventually causing it to run out of file descriptors and crash.

How to reproduce in Gnome Wayland session:
 1. Choose buildings_tools tool with ""B"".
 1. Move cursor over JOSM drawing area.
 1. See constant increase of open files in Gnome (Wayland): {{{watch -n 1 -d 'ls -l /proc/`pidof gnome-shell`/fd/ | wc -l'}}}.
 1. Choose any other tool, e. g. with ""W"".
 1. Move cursor over JOSM drawing area and see no open file increase.

More details about this problem on Wayland side: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1306

Problem is probably caused by something in DrawBuildingAction.java updCursor():
{{{#!java
    private void updCursor() {
        if (!MainApplication.isDisplayingMapView())
            return;

        if (!ctrl && (mousePos != null)) {
            Node n = MainApplication.getMap().mapView.getNearestNode(mousePos, OsmPrimitive::isSelectable);
            if (n != null) {
                setCursor(cursorJoinNode);
                return;
            } else {
                Way w = MainApplication.getMap().mapView.getNearestWay(mousePos, OsmPrimitive::isSelectable);
                if (w != null && w.get(""building"") != null) {
                    setCursor(cursorJoinWay);
                    return;
                }
            }
        }
        if (customCursor != null && (!ctrl || isRectDrawing()))
            setCursor(customCursor);
        else
            setCursor(getCursor());

    }
}}}

I tried to follow [wiki:DevelopersGuide/DevelopingPlugins] to debug this, but for some reason couldn't even checkout JOSM plugins repository over SVN ({{{svn co https://josm.openstreetmap.de/osmsvn/applications/editors/josm}}} – nothing happens for hours) and did not find a git mirror of this repository..."	defect	closed	normal		Plugin buildings_tools	latest	fixed	wayland	
