Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Commit e46e53a

Browse filesBrowse files
committed
[[ Bug 22705 ]] Resolve crash focusing on unopen stack
This patch resolves a crash where `controlgainedfocus` is called with a stack parameter which is unopened and therefore `p_stack -> getwindow()` returns `nullptr`.
1 parent b527ae8 commit e46e53a
Copy full SHA for e46e53a

File tree

Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed

‎docs/notes/bugfix-22705.md

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix crash focusing on an unopen stack

‎engine/src/desktop-dc.cpp

Copy file name to clipboardExpand all lines: engine/src/desktop-dc.cpp
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,11 @@ MCImageBitmap *MCScreenDC::snapshot(MCRectangle &p_rect, uint4 p_window, MCStrin
11141114

11151115
void MCScreenDC::controlgainedfocus(MCStack *p_stack, uint32_t p_id)
11161116
{
1117-
MCPlatformSwitchFocusToView(p_stack -> getwindow(), p_id);
1117+
MCPlatformWindowRef t_window = p_stack -> getwindow();
1118+
if (t_window != nullptr)
1119+
{
1120+
MCPlatformSwitchFocusToView(p_stack -> getwindow(), p_id);
1121+
}
11181122
}
11191123

11201124
void MCScreenDC::controllostfocus(MCStack *p_stack, uint32_t p_id)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.