Fix: Null-guards and unmanaged memory leaks#240
Merged
AnnaSasDev merged 7 commits intoInfiniLore:corefrom Apr 15, 2026
Merged
Conversation
- Add null-guards to WM_ACTIVATE and IsColorSchemeChange (InfiniLore#226, InfiniLore#151) - Add safe conversion from BOOL to bool type (InfiniLore#223) - Fix build variables for Linux and macOS (InfiniLore#231) - Fix unmanaged first subscription by zero-value skip (InfiniLore#232) - Fix unmanaged alloc in GetUserAgent, GetTitle, GetIconFileName getters by safe copying (InfiniLore#224)
AnnaSasDev
approved these changes
Apr 15, 2026
Member
D:\a\InfiniFrame\InfiniFrame\tests\InfiniFrameTests.Playwright\bin\Release\net8.0\InfiniFrameTests.Playwright.dll (net8.0|x64) Zero tests ran (7s 167ms)
Exit code: -1073741819
Error output: Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
at InfiniFrame.Native.InfiniFrameNative.<SendWebMessage>g____PInvoke|60_0(IntPtr, Byte*)
--------------------------------
at InfiniFrame.Native.InfiniFrameNative.SendWebMessage(IntPtr, System.String)
at InfiniFrame.InfiniFrameWindow+<>c__DisplayClass147_0.<SendWebMessage>b__0()
at InfiniFrame.Native.InfiniFrameNative.<WaitForExit>g____PInvoke|62_0(IntPtr)
at InfiniFrame.Native.InfiniFrameNative.<WaitForExit>g____PInvoke|62_0(IntPtr)
at InfiniFrame.Native.InfiniFrameNative.WaitForExit(IntPtr)
at InfiniFrame.InfiniFrameWindow.<WaitForClose>b__144_0()
at InfiniFrame.InfiniFrameWindow.Invoke(System.Action)
at InfiniFrame.InfiniFrameWindow.WaitForClose()
at InfiniFrameTests.Shared.InfiniFrameServerTestUtility+<>c__DisplayClass11_0.<Create>b__0()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)Seens to be that something went wrong with dotnet 8 and dotnet 9 Playwright |
…ling during shutdown via Invoke double-check
Contributor
Author
|
@AnnaSasDev This problem appeared not bcs of me. I launched tests before the last merge from InfiniFrame upstream: So the problem comes with your commit here: bde0e05 |
Contributor
Author
|
Fixed with double-check in invoke. All tests passed: https://github.com/freakdaniel/InfiniFrame/actions/runs/24456388737 |
AnnaSasDev
approved these changes
Apr 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed critical memory safety and correctness bugs in InfiniFrame.Native and managed interop layer, addressing null pointer dereferences, memory corruption, memory leaks, and platform-specific build issues
Type of Change
Affected Modules / Scope
Changes Introduced
Related Issues
Closes #224
Closes #226
Closes #223
Closes #231
Closes #232
Closes #151
Closes #182
Checklist
Additional Context
#224 - C API String Ownership Violation
c_str()pointers but documentation stated callers must free them#223 - bool/BOOL Type Mismatch (Memory Corruption)
bool*(1 byte) cast toBOOL*(4 bytes) in WebView2 API calls caused stack corruption*enabled = (boolValue != FALSE)#226 - Null Pointer Dereference in WM_ACTIVATE
#151 - Null Function Pointer in Dark Mode
#232 - EventSubscription Token 0 Bug
m_token != 0m_nextTokeninitial value from 0 to 1#231 - Platform-Specific CMake Variables
#182 - CustomSchemeNames Memory Leak
Testing Notes
These fixes address memory safety issues that may not be caught by existing tests