1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-25 09:15:49 +03:00

fix : Memory leak fix

This commit is contained in:
Syahmi Zul 2025-06-14 02:45:08 +08:00
parent 7df6587912
commit aeeda5755f

View file

@ -21,6 +21,8 @@ const FONT = {};
const SYM = {};
const OSD = {};
// Stuff related to the "preset" positioning
let globalMenuClickHandler = null;
const positionConfigs = {
TL: {
label: "Top Left",
@ -3662,7 +3664,8 @@ osd.initialize = function (callback) {
$(this).removeClass("show");
});
// Global click handler to close menus
$(document).on("click", hideAllMenus);
globalMenuClickHandler = hideAllMenus;
$(document).on("click", globalMenuClickHandler);
// Make field container relative positioned to contain the absolute positioned menu
$field.css("position", "relative");
// Append all elements
@ -3982,6 +3985,12 @@ osd.cleanup = function (callback) {
if (callback) {
callback();
}
// Remove position menu click handler
if (globalMenuClickHandler) {
$(document).off("click", globalMenuClickHandler);
globalMenuClickHandler = null;
}
};
TABS.osd = osd;