Skip to content
This repository was archived by the owner on Sep 16, 2019. It is now read-only.
This repository was archived by the owner on Sep 16, 2019. It is now read-only.

Sledge stuck in infinite loop when multiple tabs are open #311

@SamVanheer

Description

@SamVanheer

When multiple tabs are open Sledge will get stuck in an infinite loop because it continually raises Document:Activated events in response to tab change events. An event handler for Document:Activated sets the tab index which raises the tab change event.

The documentation for SelectedIndex and SelectedIndexChanged say nothing about raising events if the value is the same, and the source code for the Core port (https://github.com/dotnet/winforms/blob/bced3b69dfb164230f300877a595afc9a000d1a6/src/System.Windows.Forms/src/System/Windows/Forms/TabControl.cs) indicates that it shouldn't, but it is calling into native code for a portion of the logic.

I suggest adding a sanity check to the event handler to ignore tab change events if the index hasn't actually changed to stop the infinite loop.
Alternatively, don't change the tab index if the value is identical (this should match what WinForms is doing internally though).

Note that this only appears to be happening when Sledge is opened with multiple tabs to restore. It didn't happen when i initially opened the maps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions