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

Crash To Desktop when click on calltip created with LUA or Python Script Plugin #14664

Closed
Khundiann opened this issue Feb 2, 2024 · 11 comments
Closed
Assignees

Comments

@Khundiann
Copy link

Khundiann commented Feb 2, 2024

Description of the Issue

When creating calltips with "Overload arrows" with either PythonScript or LuaScript plugins, clicking on the down arrow makes Notepad++ crash to desktop. Clicking on the up arrow or general area of the calltip works as it should.

Steps to Reproduce the Issue

  1. Install the PythonScript plugin
  2. run the script below
def showcalltip(args):
	calltip = "\001 Click \002"
	pos = editor.getCurrentPos()
	editor.callTipShow(pos, calltip)

def printclick(args):
    print(args)

console.show()
print("Test script running.")

editor.callback(showcalltip, [SCINTILLANOTIFICATION.CHARADDED])
editor.callback(printclick, [SCINTILLANOTIFICATION.CALLTIPCLICK])
  1. Type any character in a document and the calltip will appear.
  2. Click on the up arrow and the general area of the calltip and the arguments will be shown in console.
  3. When clicking on the down arrow (or using the alt + down shortcut) makes Notepad++ crash to desktop with Exception Code: c0000094 which is a division by zero code. Seems the position key cannot return a value 2 as it fails to get a value. And Exception Code: c000041d a STATUS_FATAL_USER_CALLBACK_EXCEPTION code.

Expected Behavior

When clicking the down arrow I expected to see the arguments in console.

Actual Behavior

Notepad++ crashed to desktop

Debug Information

Notepad++ v8.6   (64-bit)
Build time : Nov 23 2023 - 16:58:44
Path : P:\npp.8.6.portable.x64\notepad++.exe
Command Line : 
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 22H2
OS Build : 19045.3930
Current ANSI codepage : 1252
Plugins : 
    ComparePlus (1.1)
    Explorer (1.9.9)
    GitSCM (1.4.8.2)
    HTMLTag (1.4.1)
    LuaScript (0.12)
    mimeTools (2.9)
    nppAutoDetectIndent (2.3)
    NppConverter (4.5)
    NppEventExec (0.9)
    NppExec (0.8.4)
    NppExport (0.4)
    NppSnippets (1.7.1)
    NppUISpy (1.2)
    NppXmlTreeviewPlugin (2)
    PreviewHTML (1.3.2)
    Python Indent (1.0.0.5)
    PythonScript (2)
    XMLTools (3.1.1.13)
    _CustomizeToolbar (5.3)

Exactly the same happens when using the LuaScript plugin, I'll include a test script for that too.

function showcalltip(ch)
	calltip = "\001 Click \002"
	pos = editor.CurrentPos
	editor:CallTipShow(pos, calltip)
    return false
end

function printclick(flag)
    print(flag)
    return false
end

print("Test script running.")
 
npp.AddEventHandler("OnChar", showcalltip)
npp.AddEventHandler("OnCallTipClick", printclick)
@alankilborn
Copy link
Contributor

I'm curious if you've tried this minimally, i.e., with only the plugins that ship with Notepad++, and a singled scripting plugin (i.e., if you're trying the Python, then only have the PythonScript plugin installed)

@alankilborn
Copy link
Contributor

More discussion on the Community site: https://community.notepad-plus-plus.org/topic/25374

@Khundiann
Copy link
Author

I'm curious if you've tried this minimally, i.e., with only the plugins that ship with Notepad++, and a singled scripting plugin (i.e., if you're trying the Python, then only have the PythonScript plugin installed)

I just tried with a clean portable install of Notepad++ 8.6.2 and the result is the same.

Notepad++ v8.6.2 (64-bit)
Build time : Jan 14 2024 - 02:16:00
Path : P:\npp.8.6.2.portable.x64\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 22H2
OS Build : 19045.3930
Current ANSI codepage : 1252
Plugins :
mimeTools (3)
NppConverter (4.5)
NppExport (0.4)
PythonScript (2)
RandomValuesNppPlugin (0.3)

@rdipardo
Copy link
Contributor

rdipardo commented Feb 2, 2024

The crash does not occur when the buffer is normal text (i.e. has no active syntax highlighting).

@Khundiann, is that also the case for you?

@Khundiann
Copy link
Author

The crash does not occur when the buffer is normal text (i.e. has no active syntax highlighting).

@Khundiann, is that also the case for you?

@rdipardo I can confirm running the script and testing it with "normal text" selected as language works.

@xomx
Copy link
Contributor

xomx commented Feb 2, 2024

1st exception is the integer division by zero because of the _currentNbOverloads == 0 there (then the 0xC000041D follows)

_currentOverload = (_currentOverload+1) % _currentNbOverloads;

@Khundiann
Copy link
Author

@xomx @rdipardo That was solved swiftly and with style! Thanks guys!
Should I close this issue, or will someone else take care of that?

@alankilborn
Copy link
Contributor

Should I close this issue, or will someone else take care of that?

You shouldn't close anything.
Nothing is fixed yet.
If a fix gets made, part of the fix acceptance will include closing this issue.

@xomx
Copy link
Contributor

xomx commented Feb 3, 2024

@Khundiann
Do not close.
I am not the author of this FunctionCallTip code, so at the moment I have no idea what is going on and why.
Maybe there is a problem or something unusual in your script, but of course the N++ should not crash even if that were true.

@donho donho self-assigned this Feb 3, 2024
donho added a commit to donho/notepad-plus-plus that referenced this issue Feb 3, 2024
@donho
Copy link
Member

donho commented Feb 3, 2024

@Khundiann
Please check fix #14667 to see if your crash is fixed.

@Khundiann
Copy link
Author

@Khundiann Please check fix #14667 to see if your crash is fixed.

@donho
I can confirm the fix works, Thanks!

2024-02-03 20_47_38-Window

Notepad++ v8.6.2 (64-bit)
Build time : Feb 3 2024 - 20:32:33
Path : P:\PROJECTS VSCODE\notepad++\PowerEditor\bin64\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 22H2
OS Build : 19045.3930
Current ANSI codepage : 1252
Plugins :
PythonScript (2)

@donho donho closed this as completed in f09b653 Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants