mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 21:47:00 -04:00
Don't allocate wxToolBarToolBase, that can lead to memory corruption and two days of debugging.
This commit is contained in:
+2
-6
@@ -290,13 +290,9 @@ wxToolBarToolBase* add_tool(wxToolBar* toolbar, int id, const char* resource, co
|
|||||||
#else
|
#else
|
||||||
Image disabled_bitmap = generate_disabled_image(bitmap);
|
Image disabled_bitmap = generate_disabled_image(bitmap);
|
||||||
#endif
|
#endif
|
||||||
auto tool = new wxToolBarToolBase(toolbar, id, label, bitmap, disabled_bitmap, kind, nullptr, tooltip, help);
|
return toolbar->AddTool(id, label, bitmap, disabled_bitmap, kind, tooltip, help);
|
||||||
toolbar->AddTool(tool);
|
|
||||||
return tool;
|
|
||||||
} else {
|
} else {
|
||||||
auto tool = new wxToolBarToolBase(toolbar, id, label, wxNullBitmap, wxNullBitmap, kind, nullptr, tooltip, help);
|
return toolbar->AddTool(id, label, wxNullBitmap, wxNullBitmap, kind, tooltip, help);
|
||||||
toolbar->AddTool(tool);
|
|
||||||
return tool;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user