Skip to content

Commit 9d1601e

Browse files
bcmpincwhitequark
authored andcommitted
Fix uninitialized memory access in toolbar.
1 parent 8d07a6b commit 9d1601e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/graphicswin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ void GraphicsWindow::Init() {
390390

391391
showSnapGrid = false;
392392
context.active = false;
393+
toolbarHovered = Command::NONE;
393394

394395
if(!window) {
395396
window = Platform::CreateWindow();

src/toolbar.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
154154

155155
bool withinToolbar =
156156
(mx >= aleft && mx <= aright && my <= atop && my >= abot);
157+
158+
// Initialize/clear menuHit.
159+
if(menuHit) *menuHit = Command::NONE;
157160

158161
if(!canvas && !withinToolbar) {
159162
// This gets called every MouseMove event, so return quickly.
@@ -224,9 +227,5 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
224227
}
225228
}
226229

227-
if(!withinToolbar) {
228-
if(menuHit) *menuHit = Command::NONE;
229-
}
230-
231230
return withinToolbar;
232231
}

0 commit comments

Comments
 (0)