Skip to content

Commit

Permalink
Fixed possible crash after a scripted tool disappears while active
Browse files Browse the repository at this point in the history
For example, when switching away from a project while having a scripted
tool selected, the roaming MapEditor::mSelectedTool pointer could end up
being referenced in MapEditor::setCurrentDocument, causing a crash.
  • Loading branch information
bjorn committed Jan 12, 2024
1 parent d1c1fb8 commit e11d4ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* tmxviewer: Added support for viewing JSON maps (#3866)
* Windows: Fixed the support for WebP images (updated to Qt 6.5.3)
* Fixed mouse handling issue when zooming while painting (#3863)
* Fixed possible crash after a scripted tool disappears while active

### Tiled 1.10.2 (4 August 2023)

Expand Down
2 changes: 1 addition & 1 deletion src/tiled/toolmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void ToolManager::unregisterTool(AbstractTool *tool)
it.remove();

if (mSelectedTool == tool)
mSelectedTool = nullptr;
setSelectedTool(nullptr);

autoSwitchTool();
}
Expand Down

0 comments on commit e11d4ee

Please sign in to comment.