From 23e696e141280825ab575533d2e4a0fcdf299fa2 Mon Sep 17 00:00:00 2001 From: Dusk <24+dusk@noreply.octowow.st> Date: Mon, 14 Sep 2026 10:09:55 +0000 Subject: [PATCH] Make Open Mail recovery lazy and bump to 1.4.12 - Leave the existing Open Mail button untouched during normal mailbox opens - Only run full recovery if the button is missing, hidden or re-parented - Match Otari-style normal behavior while keeping compatibility recovery - Keep Open All, inbox polling, sending and logging unchanged - Bump version to 1.4.12 --- AUDIT.md | 6 +++++- README.md | 3 ++- TurtleMail.toc | 2 +- TurtleMailFix.lua | 19 +++++++++++++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/AUDIT.md b/AUDIT.md index 058c615..37105a8 100644 --- a/AUDIT.md +++ b/AUDIT.md @@ -35,6 +35,10 @@ Target: Turtle WoW 1.18.x / Octo client. - **Residual mailbox hitch / excessive garbage generation:** the upstream `GetContainerItemInfo` hook used `pack()` + `unpack()` for every bag query, allocating a temporary table each time. Bag/mailbox refreshes can call this path very frequently and trigger avoidable garbage collection pauses. 1.4.11 replaces the installed hook after login with a fixed-local wrapper that performs no per-call table allocation. The native return count is detected once and the exact arity is preserved for signatures of up to 12 return values; unusual signatures fall back to the previous hook. +## Fixed in 1.4.12 + +- **Open Mail recovery overhead on mailbox open:** 1.4.11 still called the full `ensure_open_mail_button()` routine from `MAIL_SHOW()`. Even when the button was healthy, that path inspected parent, anchor, label, script, size, frame level and visibility. 1.4.12 keeps the normal path Otari-like: if `TurtleMailOpenMailButton` already exists, is parented to `InboxFrame`, and is shown, `MAIL_SHOW()` leaves it completely untouched. The full recovery routine now runs only if the button is missing, hidden, or re-parented. No inbox polling, Open All, sending, logging, or mail-processing logic is changed. + ## Remaining architectural risks upstream These are intentionally not rewritten in the compatibility layer because changing them would be much more invasive and could alter mail behavior: @@ -56,4 +60,4 @@ The compatibility build was tested in-game on Turtle WoW 1.18.x and the reported ## Status -**1.4.11 is the current test build pending in-game validation.** The fixes remain isolated in `TurtleMailFix.lua` so upstream code stays easy to compare and future upstream changes remain easier to merge. +**1.4.12 is the current test build pending in-game validation.** The fixes remain isolated in `TurtleMailFix.lua` so upstream code stays easy to compare and future upstream changes remain easier to merge. diff --git a/README.md b/README.md index fe476c1..8e3cbaf 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ When enabled, TurtleMail records sent and received mail information in its dedic ## 🔧 Turtle WoW compatibility -Version **1.4.11** extends the compatibility, safety, and performance layer for Turtle WoW 1.18.x environments. +Version **1.4.12** extends the compatibility, safety, and performance layer for Turtle WoW 1.18.x environments. The compatibility work is isolated in `TurtleMailFix.lua` so the original TurtleMail code remains easier to compare with upstream versions. @@ -98,6 +98,7 @@ The compatibility work is isolated in `TurtleMailFix.lua` so the original Turtle - Fixed `MailMailButton` nil crashes while enabling/disabling or clearing the send form, and hardened the paired subject edit-box reference. - Restored the missing **Open Mail** button with an idempotent recovery path. - Reduced first-open mailbox stutter by removing Open Mail layout repair from `MAIL_INBOX_UPDATE` and only changing the button when its state is actually wrong. +- Made Open Mail recovery fully lazy on mailbox open: normal openings now leave the existing button completely untouched, matching Otari-style behavior; full repair only runs if the button is missing, hidden, or re-parented. The complete technical audit is available in [`AUDIT.md`](AUDIT.md). diff --git a/TurtleMail.toc b/TurtleMail.toc index 8f736f3..da99e8f 100644 --- a/TurtleMail.toc +++ b/TurtleMail.toc @@ -2,7 +2,7 @@ ## Interface: 11200 ## Title: |cffabd473Turtle|cffffffffMail ## Author: shirsig/sica, Dusk-92 (compatibility fixes) -## Version: 1.4.11 +## Version: 1.4.12 ## Notes: Mailbox enhancement - Turtle WoW 1.18.x compatibility ## SavedVariables: TurtleMail_AutoCompleteNames ## SavedVariablesPerCharacter: TurtleMail_To TurtleMail_Point TurtleMail_Log diff --git a/TurtleMailFix.lua b/TurtleMailFix.lua index 2d0e2d9..c0d437e 100644 --- a/TurtleMailFix.lua +++ b/TurtleMailFix.lua @@ -8,7 +8,7 @@ local m = TurtleMail local getn = table.getn local function pack( ... ) return arg end -m.compat_version = "1.4.11" +m.compat_version = "1.4.12" local DEFAULT_SENT_FILTERS = { Money = 1, @@ -475,11 +475,22 @@ end -- Safer MAIL_SHOW: package-button regions differ between UI replacements. function m.MAIL_SHOW() - -- Re-assert the legacy references whenever the mailbox opens. This also - -- recovers if another UI addon changed those globals after addon loading. + -- Re-assert the legacy send-widget references whenever the mailbox opens. + -- Open Mail follows the lighter Otari-style path: when the existing button + -- is still shown and parented to InboxFrame, do nothing at all. Only invoke + -- the full recovery routine if the button is missing, hidden, or re-parented. ensure_send_mail_button() ensure_subject_edit_box() - ensure_open_mail_button() + + local open_mail_button = m.api.TurtleMailOpenMailButton + local open_mail_ok = open_mail_button + and type( open_mail_button.SetPoint ) == "function" + and (not open_mail_button.GetParent or open_mail_button:GetParent() == m.api.InboxFrame) + and (not open_mail_button.IsShown or open_mail_button:IsShown()) + + if not open_mail_ok then + ensure_open_mail_button() + end if not m.api.MailFrame then return end