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:
parent
7df6587912
commit
aeeda5755f
1 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue