-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Opening a dialog from the CSV Lint window causes NPP to hang if the window is undocked #83
Comments
I tried to run this project in the Visual Studio debugger (with the target framework changed to With the debugger on, I observed that the infinite loop begins in the When I turned on decompilation of C# core code, I found that the exact place where the infinite loop begins is in So for some reason, setting the I also tried registering the |
As a note to plugin developers facing this issue in the future, you should take the time to read this comprehensive discussion of how window message handling can go wrong in high-level languages like C# or Delphi/Object Pascal (the latter being the historical predecessor to .NET). The TL;DR is — roughly — when you register a form with child components like buttons, memos, etc. (by sending Problem is, your native GUI library (WinForms, VCL, etc.) doesn't know what has happened, so it keeps on sending window messages to your child controls. Since the OS believes your form is a child and not a parent, the UI thread gets caught in an endless loop of trying and failing to locate the child controls. In my experience, the only effective workaround is to trap the |
Based on @rdipardo 's comment just now, I figured out what the problem is: the problem occurs when the button that opens another form is inside a GroupBox (or other "container" control; in CsvLint it's a SplitContainer) in a docking form. The SelectionRememberingForm in NppCSharpPluginPack, which is a docking form, does not have this issue, but if I put the button that opens another form inside a group box, the problem re-emerges. Note that having a GroupBox or other container in the form is not sufficient; if the button that opens another form is not inside a container, I can still open a form from the SelectionRememberingForm while it is undocked. Once I figure out how to stop the bug in NppCSharpPluginPack, I'll submit a PR. |
@molsonkiko Excellent work, thanks for the PR, this has fixed the issue |
I tried adding more or less the same code to my NppCSharpPluginPack, and it occasionally seems to cause Notepad++ to crash when I undocked a docking form (the SelectionRememberingForm). I haven't replicated it the last few times I've tried, and I'm not even sure it's a problem with this plugin (the nondeterminism suggests it's related to multithreading, but this code is synchronous), but be on the lookout. I cannot replicate the same problem with a local fork of CSVLint, which makes it even less likely that it's a problem with this code. |
Steps to reproduce
Sort
button.I recognize that this is a relatively niche case, and I only found out about it in this discussion.
This happened while I was using 0.4.6.5 on Notepad++ 8.5.8.
As far as I can tell, JsonTools does not have a similar problem, and I don't really understand why. I've tried undocking the tree viewer and opening the
Query to CSV
andFind/replace
dialogs from it while it is undocked, and I don't get a crash.The text was updated successfully, but these errors were encountered: