Closed OneSecure closed 8 years ago
What exactly is the crash this is supposed to fix?
On Sep 9, 2016 12:24, "OneSecure" notifications@github.com wrote:
Crash fixing.
You can view, comment on, or merge this pull request online at:
https://github.com/XhmikosR/notepad2-mod/pull/172 Commit Summary
- Crash fixing.
File Changes
- M src/Helpers.c https://github.com/XhmikosR/notepad2-mod/pull/172/files#diff-0 (3)
Patch Links:
- https://github.com/XhmikosR/notepad2-mod/pull/172.patch
- https://github.com/XhmikosR/notepad2-mod/pull/172.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/XhmikosR/notepad2-mod/pull/172, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVVtXuiXXLhLTKu7G6sHjlcCQ0i6ojOks5qoSXTgaJpZM4J43FZ .
When we run the app in first time, the array is empty.
PathAbsoluteFromApp(pmru->pszItems[i],wchItem,COUNTOF(wchItem),TRUE);
Will crush.
void PathAbsoluteFromApp(LPWSTR lpszSrc,...) { ... if (StrCmpNI(lpszSrc,..) == 0) { ... } else lstrcpyn(wchPath,lpszSrc,COUNTOF(wchPath));
Here lpszSrc can not be null.
First time to run app. The registry is empty. The app will crash.
Have tested with version: Notepad2-mod.4.2.25.985 Both x64 and x86.
I have tried to reproduce by running the exe file with and without the initial ini file present but am unable to make it crash. Have also looked at the code. No obvious execution path that leads to calling MRU_AddFile. Can you please describe the steps to make it crash.
Drag and drop a file to the editor, this moment it try to add the file path to the MRU. If the MRU array is empty. The app will crush.
I did drag and drop a txt file when I tried to reproduce the crash. It didn't crash. To be sure I retried again. Both ways starting without the initial ini file present.
Way 1: start notepad2-mod Settings->Save settings now Settings->Remember recent files Drag and dropped from explorer a txt file. No crash.
Way 2: start notepad2-mod Drag and dropped from explorer a txt file. No crash.
More details are needed. What operating system are you running? If you are willing, able to and have time perhaps a video recording of it will help.
Myself is running Windows 7 ultimate x64.
Please look the following image. https://pbs.twimg.com/media/CxMoWmLUAAAbsNz.jpg:large
I've stepped through the code both in debug and release using Visual Studio 2010 with platform toolset v100. It doesn't crash but it really should! In lstrcpyn when it should crash it just jumps out of the function and continues as if nothing have happened.
https://postimg.org/image/f6y5pxaan/
First I thought you might be running a debug version of Windows or it's the newer Visual Studio or the lstrcpyn behaves differently internally.
I didn't manage to get it to crash on its own but I did make it to admit something were wrong.
By default Visual Studio 2010 settings, Menu, Debug->Exceptions... are set to ignore such exceptions and pass is it to the software, anyway somehow Notepad2-mod is just ignoring the exception and potentially leaving itself in a corrupt state.
https://postimg.org/image/zd1not5y7/
By any chance do you compile your own version or do you use the official one already compiled? Might explain why it crash for you and not me.
You're correct there needs to be a NULL check but shouldn't it be first? Like so:
for (i = 0; i < pmru->iSize; i++) {
+ if (pmru->pszItems[i] == NULL) {
+ break;
+ } else
if (lstrcmpi(pmru->pszItems[i],pszFile) == 0) {
Apologize, I got really confused with that it didn't crash or popup an exception dialog for me on it's own. Had to free up some hd space (took time), use visual studio, rebuild to get pdb file and use vs2010 to catch the exception.
@XhmikosR , you know notepad2-mod better than me. Do you have any idea of why it doesn't behave as it should? This code also needs some serious TLC. Perhaps a rewrite to catch all the issues like for example this one. More or less luck that it runs.
A bit off topic: Would be nice if you made the pdb file available for download for each new release. Would be convenient.
Yes. Because the project file is VS 2012, I can't convert it to my VS 2015 format. So I create a new project file from scratch. And I run it under debug mode, so I meeting with the crush.
I see no reason one would still use VS 2012. If the crash doesn't happen with 2015 this is obsolete.
Fuck you!
Crash fixing.