Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Quality: Removed Vanara from ShellPreviewViewModel #16945

Merged
merged 3 commits into from
Mar 26, 2025

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented Mar 16, 2025

Resolved / Related Issues

Steps used to test these changes

  1. Open Files.
  2. Select a DOCX, a PDF, etc.
  3. Select another one annd switch between them several times to see if the preview handler is disposed correctly.

@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-CsWin32ShellPreviewing branch from b7f4136 to 449f1dc Compare March 16, 2025 17:30
@0x5bfa
Copy link
Member Author

0x5bfa commented Mar 16, 2025

CC @hez2010

Ready, confirmed to be working well.

@hez2010
Copy link
Member

hez2010 commented Mar 18, 2025

I'm OOF this week. Will take a look later.

@yaira2 yaira2 force-pushed the main branch 7 times, most recently from 30cea65 to decf3da Compare March 24, 2025 21:33
Copy link
Member

@hez2010 hez2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Left some comments.

Comment on lines +137 to +139
_windProc = new(WndProc);
var pWindProc = Marshal.GetFunctionPointerForDelegate(_windProc);
var pfnWndProc = (delegate* unmanaged[Stdcall]<HWND, uint, WPARAM, LPARAM, LRESULT>)pWindProc;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to avoid using GetFunctionPointerForDelegate. Instead, marking WndProc as static and UnmanagedCallersOnly and taking a function pointer from it directly.
While we don't need to do it immediately in this PR as it may require some refactor to WndProc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Since making proc-s static has huge impact like you said, i was hesitant to do this (while I understand using GetFunctionPointerForDelegate has performance impact likewise)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im curious, if you were to, how would you refactor (roughly)?

@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Mar 25, 2025
@yaira2
Copy link
Member

yaira2 commented Mar 25, 2025

@0x5bfa can you please resolve the conflicts?

0x5bfa and others added 3 commits March 26, 2025 13:34
…wModel.cs

Co-authored-by: Steve <hez2010@outlook.com>
Signed-off-by: 0x5BFA <62196528+0x5bfa@users.noreply.github.com>
@0x5bfa 0x5bfa force-pushed the 5bfa/CQ-CsWin32ShellPreviewing branch from 0ca9b55 to 141bc82 Compare March 26, 2025 04:35
@yaira2 yaira2 merged commit 6cee330 into files-community:main Mar 26, 2025
6 checks passed
@0x5bfa 0x5bfa deleted the 5bfa/CQ-CsWin32ShellPreviewing branch March 26, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants