Changeset 35929 in osm for applications/editors/josm


Ignore:
Timestamp:
2022-03-14T19:12:37+01:00 (3 years ago)
Author:
taylor.smock
Message:

fix #21929: buildings_tools creating unnecessary file descriptors

This causes XWayland to crash (Java uses XWayland at this time, when run under
Wayland). buildings_tools causes this problem by constantly creating new
cursors in the EDT thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/buildings_tools/src/org/openstreetmap/josm/plugins/buildings_tools/DrawBuildingAction.java

    r35916 r35929  
    4949public class DrawBuildingAction extends MapMode implements MapViewPaintable, DataSelectionListener,
    5050        KeyPressReleaseListener, ModifierExListener {
     51    // We need to avoid opening many file descriptors on Linux under Wayland -- see JOSM #21929. This will probably also
     52    // improve performance, since we aren't creating cursors all the time.
     53    private static final Cursor CURSOR_SILO = ImageProvider.getCursor("crosshair", "silo");
     54    private static final Cursor CURSOR_BUILDING = ImageProvider.getCursor("crosshair", "building");
     55
    5156    private enum Mode {
    5257        None, Drawing, DrawingWidth, DrawingAngFix
     
    8792        try {
    8893            if (ToolSettings.Shape.CIRCLE == ToolSettings.getShape()) {
    89                 return ImageProvider.getCursor("crosshair", "silo");
     94                return CURSOR_SILO;
    9095            } else {
    91                 return ImageProvider.getCursor("crosshair", "building");
     96                return CURSOR_BUILDING;
    9297            }
    9398        } catch (Exception e) {
Note: See TracChangeset for help on using the changeset viewer.