Skip to content

Commit be041b4

Browse files
committed
Potential fix for the re-introduced window crash by not executing anything on the window right after creation
1 parent c71c3b5 commit be041b4

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

SimpleGraphic.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28307.960
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30907.101
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleGraphic", "SimpleGraphic.vcxproj", "{62A6B2C3-84CC-49CC-BAD7-DD0A4BFE05CB}"
77
EndProject

engine/system/win/sys_video.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ int sys_video_c::Apply(sys_vidSet_s* set)
238238
}
239239
} else {
240240
if (cur.shown) {
241-
style|= WS_VISIBLE;
241+
style |= WS_VISIBLE;
242+
}
243+
if (cur.flags & VID_MAXIMIZE) {
244+
style |= WS_MAXIMIZE;
242245
}
243246
hwnd = CreateWindowEx(
244247
exStyle, CFG_TITLE " Class", curTitle, style,
@@ -247,9 +250,9 @@ int sys_video_c::Apply(sys_vidSet_s* set)
247250
);
248251
if (hwnd == NULL) {
249252
sys->Error("Unable to create window");
253+
return 0;
250254
}
251255
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)sys);
252-
sys->conWin->SetForeground();
253256
}
254257

255258
// Calculate minimum size
@@ -264,7 +267,7 @@ int sys_video_c::Apply(sys_vidSet_s* set)
264267
minSize[1] = rec.bottom - rec.top;
265268
}
266269

267-
if (cur.flags & VID_MAXIMIZE) {
270+
if (initialised && (cur.flags & VID_MAXIMIZE)) {
268271
ShowWindow(hwnd, SW_MAXIMIZE);
269272
}
270273

0 commit comments

Comments
 (0)