Skip to content

fix: fixed crash in Node 22+ by using Buffer instead of {} with EnumDisplaySettingsA#17

Merged
teo-nikolov merged 2 commits intomainfrom
fix/node-22-crash-fix
Apr 24, 2025
Merged

fix: fixed crash in Node 22+ by using Buffer instead of {} with EnumDisplaySettingsA#17
teo-nikolov merged 2 commits intomainfrom
fix/node-22-crash-fix

Conversation

@teo-nikolov
Copy link
Copy Markdown
Collaborator

Proposed changes

This PR fixes a crash that occurs in Node.js 22+ when calling the Windows API function EnumDisplaySettingsA via koffi with an empty object ({}). In previous Node versions, passing an object that gets populated with fields worked fine, but starting from Node 22, this behavior causes a native crash. This change replaces the object with a Buffer, which acts as a workaround for changes in Node 22+ and prevents the native crash.

Types of changes

What types of changes does your code introduce to Appium?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the Contributing Guide
  • I have signed the CLA
  • Lint passes locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@teo-nikolov teo-nikolov requested a review from n1xan April 24, 2025 16:36
@teo-nikolov teo-nikolov assigned n1xan and teo-nikolov and unassigned n1xan Apr 24, 2025
@teo-nikolov teo-nikolov merged commit 08e4907 into main Apr 24, 2025
1 check passed
@teo-nikolov teo-nikolov deleted the fix/node-22-crash-fix branch April 24, 2025 17:12
github-actions bot pushed a commit that referenced this pull request Apr 25, 2025
## [1.0.1](v1.0.0...v1.0.1) (2025-04-25)

### Bug Fixes

* fixed crash in Node 22+ by using Buffer instead of {} with EnumDisplaySettingsA ([#17](#17)) ([08e4907](08e4907))
* set shouldCloseApp's default value to true ([#18](#18)) ([28dc1d4](28dc1d4))

### Code Refactoring

* remove unnecessary debug logging for name locator ([#19](#19)) ([ad50be9](ad50be9))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants