-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Crashes NP++ when selecting a CSV tab #67
Comments
You also posted this a while ago on the Notepad++ forum, but this was a bit difficult to reproduce because it requires a specific combination of settings. Your step-by-step description helped point in the right direction, much appreciated and thanks for your patience. I think this actually has to do with the transparant cursor line setting. I was able to reproduce it like this:
After a few switches in step 5 it will crash Notepad++. When you set |
It has to do with the transparant cursor line, so I'll have to look in to that. Issue #68 is probably related. Specifically, it has to do with these lines (when I disable them it doesn't crash). Although I can't explain why it doesn't crash when there is just a single line of tabs opened. For the moment the work-around is to set the CSV Lint setting |
Thanks. Changing TransparantCursor to false fixes the issue for me. |
Synchronize with NotepadPlusPlusPluginPack.Net to eliminate the possibility that code difference was causing the crashing issue #67 (it was not)
I'm 100% certain that this has to do with these two lines i.e. when I disabled them then it doesn't crash anymore. However I can't figure out why that is. The two lines were introduced in this commit I had updated some code to eliminate the possibility that this was causing the issue, although I suspect it might have to do with this "Updated Position types to work also on 64 bit" update |
It looks like the
Start If that finds the bug, you can guard the API calls with a |
It's not a null pointer error, the Yesterday I updated the .NET Scintilla interface using these tools. which although very helpful, was still a lot of work. But then I was able to use the new
In the new situation it compiles and runs fine, but there is no alpha/transparency, see screenshot below. While debugging I used a different caret background color to more clearly see what it's doing. I checked the ColourAlpha.Value is a 32bit int and it does contain the alpha value part in the most-significant 24 bits. And on top of that it didn't solve the crash problem. 😐 |
I think it has to do more with the fact the CSV Lint is setting and resetting the caret background color when switching between tabs, in combination with one of the parameters going out of scope, somehow maybe. I tried to rule this out, by using only hardcoded values and passing a I also tried in the To be clear, when a CSV file is opend the lexer |
I'm not sure how .NET encodes RGBA colors, but I'm certain that Scintilla's format is different. Read the documentation and make sure the alpha value is in the right bit position. To be absolutely safe, use a method that shifts a color int like
It's unfortunate that comparePlus manipulates the caret line background style, but I can't see how that would lead to a crash. It could be the color int is becoming negative and overflowing in the The |
I'm aware of the RGBA encoding as a 32bit int, but this has nothing to do with that. Because it only happens when there are 2 or more lines of tabs, see the screenshot with the red arrows. When you resize the Notepad++ screen, so that it has one single line of tabs, then it doesn't crash(!?) really weird. fyi this is the implementation of the ColourAlpha I used. I'll try to also submit this as a PR for the main NotepadPlusPlus PluginPack.Net project
|
I think I've found the code path where the crash really happens, here: CSVLint/CSVLintNppPlugin/Main.cs Lines 142 to 144 in 2b4d239
The cause is definitely a null pointer exception; the Windows error log reports it it as an access violation (error code 0xC0000005), which is basically the same thing:
The reason goes back to a basic principle of object initialization. You have a CSVLint/CSVLintNppPlugin/Main.cs Line 37 in 2b4d239
When debugging I found The caret line still goes black when comparePlus is installed alongside, but that, like I said before, is just a nuisance, not something that would crash the editor. |
Attemp to fix issue #67 by using new/fixed values instead of variables, however this still has same result and crashes when switching between multiple stacked tabs
I get what you're saying, except by that logic it would be fixed by using a |
Besides the crashing with stacked tabs, the plugin would also crash at startup in very specific circumstances. I had a reproducable situation with two files, but then when I copied those files to another folder then it wasn't reproducable anymore with those files. Even renaming one file by one character (both the file and in filename in sessions.xml) and then it wouldn't crash anymore, it is really weird. See also issues #69 I spend quite some time on this, I even viewed the file and the copy/renamed file with powershell Anyway, I made an update to the plugin, see commit 241a6ee now the This fixes both cases, so the stacked tabs crash and the sessions/startup crash, only downside is that the transparent cursor line now stays transparent for the rest of the Notepad++ session also in other files. But the next release of the plugin should at least not have any unexplained edge-case crashes anymore. |
The cursor line is set to transparent and is then not changed anymore, see previous post. So this issue is fixed in the latest version v0.4.6.5, see the releases page. You can download it manually and it will be available in the next Notepad++ update in the Plugin Manager. |
Using NP++ 8.5.2 64bit and CSVLint v0.4.6.4
The crash happens with these steps:
SETTINGS REQUIRED TO RECREATE THE CRASH
Enable the Multi-Line setting for the Tab Bar (Settings / General / Tab Bar / Multi-line). When that is enabled, and the tabs wrap to 2+ lines, activating any CSV tab a 2nd time crashes NP++.
This crash even happens on a fresh download of NP++ v8.5.2 portable.
The text was updated successfully, but these errors were encountered: