about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-07-10 00:25:38 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-07-10 00:25:38 -0700
commit8f88af234a5fbb35a25c5a6ae922dbd5ffeb3dd7 (patch)
tree852a86a92fc9e74d703a69133b933ef0c69b563f /edit.lua
parentc064f0a97df56c28d9d76a226ce152d97e40450a (diff)
downloadview.love-8f88af234a5fbb35a25c5a6ae922dbd5ffeb3dd7.tar.gz
patch a vector for memory leaks
Multiple editors in an app shouldn't create duplicate font objects.

Not strictly needed for this app, but feels hard-won enough I want to
pull this in from Carousel to all forks.

This still isn't ideal. Ideally we'd automatically share the font.
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/edit.lua b/edit.lua
index 69756b7..987fa17 100644
--- a/edit.lua
+++ b/edit.lua
@@ -537,9 +537,9 @@ end
 function edit.key_release(State, key, scancode)
 end
 
-function edit.update_font_settings(State, font_height)
+function edit.update_font_settings(State, font_height, font)
   State.font_height = font_height
-  State.font = love.graphics.newFont(State.font_height)
+  State.font = font or love.graphics.newFont(State.font_height)
   State.line_height = math.floor(font_height*1.3)
 end