Skip to content

Vim9: crash when a copied function is profiled - #21491

Open
yegappan wants to merge 1 commit into
vim:masterfrom
yegappan:fix-profile-function-copy
Open

yegappan wants to merge 1 commit into
vim:masterfrom
yegappan:fix-profile-function-copy

Conversation

@yegappan

@yegappan yegappan commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Problem: Vim9: crash when profiling of a script is forced with ":profile! file" and a function defined in it is copied, such as an inherited class method or a generic function with type arguments: the copy shares the profiling data of the function and it is freed twice.

Solution: Do not share the profiling data in copy_function(), give the copy its own data when the function is profiled.

AI assistance

  • AI involvement is disclosed in the commit message
  • No AI was used

Checklist

  • The commit message follows the Problem/Solution form above
  • Signed-off-by: trailer is present (git commit -s), recommended but not required

Tests

  • Tests were added
  • Existing tests cover the change
  • The change cannot be tested (explain below)

Documentation

  • Documentation under runtime/doc/ was updated
  • No documentation update is needed

Anything reviewers should know

Found by Claude when assisting in the generic classes and interfaces implementation (#18910).

Problem:  Vim9: crash when profiling of a script is forced with
          ":profile! file" and a function defined in it is copied, such as
          an inherited class method or a generic function with type
          arguments: the copy shares the profiling data of the function and
          it is freed twice.
Solution: Do not share the profiling data in copy_function(), give the copy
          its own data when the function is profiled (Yegappan Lakshmanan).

Assisted-by: Claude
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
@yegappan
yegappan force-pushed the fix-profile-function-copy branch from 6be86b0 to 76a4b6b Compare October 12, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant