chcg / NPP_HexEdit

Notepad++ Plugin Hexedit
832 stars 156 forks source link

HexEditor crashes Notepad++ v8 while launch Distraction Free mode with Dark mode activated #51

Open donho opened 3 years ago

donho commented 3 years ago

HexEditor crashes Notepad++ v8 while launch Distraction Free mode with Dark mode activated. To reproduce:

  1. Launch Notepad++ v8
  2. Open 2 files, put them side by side
  3. Enable Dark mode via preferences dialog
  4. Launch Distraction Free mode via menu "View->Distraction Free mode"
  5. Quit Distraction Free mode by clicking + sign on th upper-right corner
  6. Launch Distraction Free mode again: crash

Note that the crash could happen on step 4, or on step 6. If step 6 does not trigger crash, repeat step 4 & step 5, until crash happens.

donho commented 3 years ago

@chcg I have debugged HexEdit for fixing the crash. However, it's just a mess in the code and I don't even understand why it crashed on a null pointer. HexEdit was not even enabled so the "doDialog" function (it crash in it) should not be called.

If you keep maintaining this project could you please check it? Otherwise I have to remove it via installer once the crash is still present.

chcg commented 3 years ago

@donho As this is just taken over by me to keep it usable to some degree I do not plan to do a major rewrite. I would concentrate on fixing major bugs like this one.

It is sufficient to have:

  1. 2 files and call "Move to other view"
  2. Launch Distraction Free mode via menu "View->Distraction Free mode"

So no relation to dark mode.

Furthermore the bug is already there before 8.0 (7.9.5 x64)

  1. 2 files
  2. call "Move to other view" on one of them
  3. call View->"Toggle Full Screen Mode" (F11)

The crash also happens. Seems to be an issue with the window handling for the second window instance.

donho commented 3 years ago

@chcg

As this is just taken over by me to keep it usable to some degree I do not plan to do a major rewrite. I would concentrate on fixing major bugs like this one.

Understandable Christian. Thank you for willing to fix this bug.

donho commented 3 years ago

@chcg Please ping me when the crash is fixed, I'll revert the following PR: https://github.com/notepad-plus-plus/notepad-plus-plus/commit/219dfda6b35af56753402c3b481804c6ed7085d1

Thank you in advance

fml2 commented 3 years ago

Do I understand it correctly that the crash only happens if some manipulations with views are made? I.e. that the crash does not happen if I just use the editor in one view?

Then: Could we leave the plugin in place (not actively remove it) and just have a warning that it may lead to a crash? And that it is used at one's own risk?

I like the plugin very much and use it quite often. And would not want to lose it.

donho commented 3 years ago

@fml2

Do I understand it correctly that the crash only happens if some manipulations with views are made? I.e. that the crash does not happen if I just use the editor in one view?

Yes, in 2 views mode, but even HexEditor is not launched.

Then: Could we leave the plugin in place (not actively remove it) and just have a warning that it may lead to a crash? And that it is used at one's own risk?

No, I can't. HexEdit has been one of the most unstable plugins since long time ago. The best case is user gets the crash with HexEdit active or doing some HexEditor's commands. But it's not even the case. Users won't understand the reason of crash, Notepad++ will be blamed - that's why HexEditor plugin has to be removed by installer.

I like the plugin very much and use it quite often. And would not want to lose it.

However, you can, after HexEditor.dll has been removed into the folder named disabled, create "HexEditor2" folder and move "HexEditor.dll" into this folder and rename it as "HexEditor2.dll". So it won't be removed by installer in your future update.

dodmi commented 3 years ago

Is there any progress with the compatibility of HexEdit and NPP 8?

aklink commented 3 years ago

However, you can, after HexEditor.dll has been removed into the folder named disabled, create "HexEditor2" folder and move "HexEditor.dll" into this folder and rename it as "HexEditor2.dll". So it won't be removed by installer in your future update.

Really Thank you for that hint! Since Notepad 6.8 (until Npp 6.7 HexEdit seemed to be very stable... but I might be wrong) there have been massive incompatibilies with HexEdit, but since development moved from Stackoverflow to Github (https://github.com/chcg/NPP_HexEdit) there was a big improvement in compatibility (Thanks to the autor!). In my opinion it is not necessary to deactivate HexEdit with every Npp update. It may have some incompatibilites in special cases, but in general it is very usefull and stable (I am not using new features of NPP like Dark Mode). After each Npp update I had to reactivate HexEdit manually... now I finally can keep it running!

Neustradamus commented 3 years ago

@donho: It is good with 0.9.10 (21-08-29)?

kotenok2000 commented 3 years ago

Now someone needs to tell notepad++ developers that they need to stop removing hexedit during updates.

Neustradamus commented 3 years ago

@kotenok2000: @donho is the main developer of Notepad++...

Maybe you can send a message directly or open a new ticket?