Skip to content

Commit 232a697

Browse files
committed
docs: oracle sweep over 5 new OSS repos (issue #201)
Runs the cross-tool oracle over 5 repos never mined before — ShareX (WinForms app), MahApps.Metro / MaterialDesignInXamlToolkit / AvalonEdit (WPF UI toolkits and controls), and ClosedXML (plain library, the clean-code control) — and triages every own-only finding against the target's real source. Per the triage boundary: draft verdicts only for obvious, source-verified cases; anything ambiguous is listed explicitly under "needs maintainer review" rather than self-certified. No analyzer code changes here — every confirmed precision gap is filed as its own follow-up issue (#218-#225), the most corroborated being a DependencyProperty/property-changed old-new subscription-rotation false positive confirmed in 3 separate repos. Nine new idioms ledgered in field-notes-patterns.md (entries 11-19). One flagship true positive (ShareX's ShapeManager.menuForm — a full annotation toolbar Form leaked every capture session) is reduced to a corpus/real-world/ regression fixture; cfg_parity.json regenerated to match. The push-triggered oracle dev-loop scaffolding used to run these sweeps (workflow_dispatch isn't available to this token) is reverted to its pre-sweep state, per the existing dev-branch-only convention. Closes #201 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D6Naf8CcezjCbikueKdeYv
1 parent 587fc2e commit 232a697

10 files changed

Lines changed: 614 additions & 4 deletions

File tree

‎.github/workflows/oracle.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ on:
4545
push:
4646
branches:
4747
- claude/zen-pasteur-76hfs1
48-
- claude/oracle-sweep-201
4948
paths:
5049
- corpus/oracle-target.txt
5150

‎corpus/oracle-target.txt‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
# or "local:<in-repo path>" (a fixture copied into the oracle's target/).
44
# Optional lines: ref=, paths=, build=, include_tests=. Dev-branch only.
55
#
6-
# issue #201 oracle sweep (5/5): ClosedXML/ClosedXML — plain library (Excel/OOXML,
7-
# Stream/IDisposable-heavy, no UI) — the clean-code control per the issue brief.
8-
ClosedXML/ClosedXML
6+
# Cross-tool oracle on a Linux-buildable fixture, so ALL THREE tools run (Infer#
7+
# included — ScreenToGif's WPF won't build on Linux). Re-run after the OWN014
8+
# migration (PR #35): the fixture's SUBSCRIPTION leak (#1 — SystemEvents.Display
9+
# SettingsChanged += with no -=) is now lowered by the extractor to a `capture`
10+
# fact and reported as OWN014 (region escape), not OWN001; OWN014 was added to the
11+
# comparator's OWN_LEAK set. So #1 must STILL land "Own.NET-only" (CodeQL / Infer#
12+
# have no event-subscription-leak query) — this run confirms the migration kept the
13+
# differentiation, on real cross-tool output rather than the selftest's fixtures.
14+
# Expect: #1 Own.NET-only (now OWN014), #2/#3/#4 dispose leaks in "Agree", 0
15+
# oracle-only.
16+
local:corpus/fixtures/systemevents-console
17+
build=SystemEventsLeak.csproj
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Fix: Dispose() also disposes menuForm (a Form is IDisposable; disposing it
2+
// tears down its whole child-control tree, per WinForms' own Control.Dispose
3+
// semantics — see field-notes-patterns.md for that transitive-disposal idiom).
4+
using System;
5+
using System.Windows.Forms;
6+
7+
internal sealed class ShapeManager : IDisposable
8+
{
9+
private Form menuForm;
10+
private readonly HistoryStack history = new HistoryStack();
11+
12+
internal void CreateToolbar()
13+
{
14+
menuForm = new Form { ShowInTaskbar = false };
15+
menuForm.Show();
16+
}
17+
18+
public void Dispose()
19+
{
20+
history.Dispose();
21+
menuForm?.Dispose();
22+
}
23+
}
24+
25+
internal sealed class HistoryStack : IDisposable
26+
{
27+
public void Dispose() { }
28+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Reduced from ShareX/ShareX @ 0df9ca4, ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs
2+
// (CreateToolbar, ~lines 62-1246) and ShapeManager.cs:2406-2411 (Dispose) — found by
3+
// the issue #201 oracle sweep.
4+
//
5+
// ShapeManager builds its on-screen annotation toolbar as a plain WPF-Forms `Form`
6+
// (`menuForm`) hosting a `ToolStripEx` with ~38 buttons/menu items/numeric-updowns/
7+
// combo-boxes, all created and owned by this class. `ShapeManager.Dispose()` exists
8+
// and disposes some of what the class owns (`history`), but forgets `menuForm`
9+
// entirely — every capture/annotation session leaks a full `Form` plus its whole
10+
// toolbar tree, because nothing else ever closes or disposes it either.
11+
using System;
12+
using System.Windows.Forms;
13+
14+
internal sealed class ShapeManager : IDisposable
15+
{
16+
private Form menuForm;
17+
private readonly HistoryStack history = new HistoryStack();
18+
19+
internal void CreateToolbar()
20+
{
21+
menuForm = new Form { ShowInTaskbar = false };
22+
// ...builds tsMain and ~38 ToolStrip child items, all added to menuForm...
23+
menuForm.Show();
24+
}
25+
26+
public void Dispose()
27+
{
28+
// real code also calls DeleteAllShapes(); irrelevant to the leak.
29+
history.Dispose();
30+
// menuForm is never disposed or closed anywhere in this class.
31+
}
32+
}
33+
34+
internal sealed class HistoryStack : IDisposable
35+
{
36+
public void Dispose() { }
37+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// OwnLang model of the ShareX ShapeManager.menuForm leak (issue #201 oracle
2+
// sweep): a class's Dispose() disposes some of its owned resources (`history`)
3+
// but forgets one it itself created (`menuForm`) — a plain owned-field leak,
4+
// the generic OWN001 acquire-with-no-release. See notes.md for the real finding.
5+
module Corpus
6+
resource Form {
7+
acquire create
8+
release dispose
9+
kind "disposable"
10+
}
11+
resource HistoryStack {
12+
acquire create
13+
release dispose
14+
kind "disposable"
15+
}
16+
fn Dispose(unused: int) {
17+
let menuForm = acquire Form(unused); // CreateToolbar(): menuForm = new Form { ... }
18+
let history = acquire HistoryStack(unused);
19+
release history; // Dispose(): history.Dispose()
20+
// no `release menuForm;` — Dispose() never touches menuForm (OWN001)
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OWN001
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# ShareX — the annotation toolbar `Form` is built but never disposed
2+
3+
**Found by the issue #201 oracle sweep** (`docs/notes/oracle-sweep-2026-07-10.md`).
4+
Target: `ShareX/ShareX` @ `0df9ca4`, `ShareX.ScreenCaptureLib/Shapes/ShapeManagerMenu.cs`
5+
(`CreateToolbar`, ~lines 62-1246) and `ShapeManager.cs:2406-2411` (`Dispose`).
6+
7+
**Pattern.** `ShapeManager.CreateToolbar()` builds the on-screen annotation/region-
8+
capture toolbar as a plain `Form` (`menuForm`), hosting a `ToolStripEx` with roughly
9+
38 buttons, menu items, numeric-updowns, and combo-boxes — all created and owned
10+
by `ShapeManager` itself (verified: every one of those ~38 fields is populated in
11+
`CreateToolbar`, and `menuForm.Controls.Add(tsMain)` / `tsMain.Items.Add(...)` wires
12+
them into the same `Form`). `ShapeManager` **does** implement `IDisposable` and
13+
**does** have a real `Dispose()`:
14+
15+
```csharp
16+
public void Dispose()
17+
{
18+
DeleteAllShapes();
19+
history.Dispose();
20+
}
21+
```
22+
23+
— but it never disposes, closes, or otherwise releases `menuForm`. Grepping the
24+
whole `ShapeManager` partial class (`ShapeManager.cs` + `ShapeManagerMenu.cs`) turns
25+
up no `menuForm.Dispose()`/`.Close()` call anywhere. Every capture/annotation
26+
session that shows the toolbar leaks a full `Form` and its entire control tree —
27+
a real, non-trivial resource leak (not merely theoretical: `CreateToolbar` is called
28+
fresh each time the toolbar is (re)shown).
29+
30+
**What the checker says (real oracle-sweep extractor output, `--flow-locals`,
31+
`--severity warning`):**
32+
33+
```text
34+
ShapeManagerMenu.cs:47: [OWN001] IDisposable field 'menuForm' (type 'Form') is
35+
never disposed — its owner 'ShapeManager' leaks it (leak) [resource: disposable field]
36+
```
37+
38+
(plus one OWN001 per never-disposed ToolStrip child field — all transitively real,
39+
since `menuForm` itself is the actual leak root; see the sweep note for the full
40+
count.) Own.NET catches this correctly — cross-checked against the real source, no
41+
`Dispose()`/`Close()` call exists anywhere for `menuForm` in either partial-class
42+
file.
43+
44+
**This `case.own`** models the shape generically: a class's `Dispose()` releases
45+
one owned resource (`history`, standing in for the real `HistoryStack`/`history`
46+
field) but never touches a second one it also owns (`menuForm`) — the plain
47+
owned-field-never-released OWN001, same core logic as the rest of the field-dispose
48+
corpus. As with the rest of the corpus, `case.own` is a hand reduction of the C#
49+
pattern (one representative field standing in for the ~38 that all share the same
50+
root cause), not a line-for-line transcription of `ShapeManagerMenu.cs`.
51+
52+
**Draft verdict: true positive**, per the issue #201 sweep's triage guardrails
53+
(final TP/FP confirmation is the maintainer's call; this is not itself a bug report
54+
filed against ShareX upstream — see `docs/notes/mining.md`'s "reporting upstream is
55+
a separate, manual step").

0 commit comments

Comments
 (0)