-
Couldn't load subscription status.
- Fork 68
Closed
Description
Bug
Notepad++ notifies of Plugin exception with either reason Access violation or Bad memory allocation when a callback is registered on SCINTILLANOTIFICATION.MODIFIED
Environment:
notepad.getAppdataPluginsAllowed() == True- Notepad 7.7.1 (x64)
- PythonScript 1.4.0 (Full, x64)
- Win10
Reproduce
I tried to create a pythonscript_logger.py to get better insights on PythonScript callback arguments, see the source code below (New Script > save > remove the MODIFIED key from the list at the bottom of the script > Run ):
from datetime import datetime
from Npp import *
from pprint import pprint
def log_event(event, args):
print('{} - {}'.format(datetime.now(), event))
pprint(args)
def initSCICallback(eventName):
editor.callback(lambda args: log_event(eventName + '', args), [SCINTILLANOTIFICATION.names[eventName]])
def initNPPCallback(eventName):
notepad.callback(lambda args: log_event(eventName + '', args), [NOTIFICATION.names[eventName]])
notepadEventValues = NOTIFICATION.names.values()
notepad.clearCallbacks(notepadEventValues)
scintillaEventValues = SCINTILLANOTIFICATION.names.values()
editor.clearCallbacks(scintillaEventValues)
for eventName in NOTIFICATION.names.keys():
print(eventName)
initNPPCallback(eventName)
for eventName in SCINTILLANOTIFICATION.names.keys():
# remove 'MODIFIED' from this line and re-indent to reproduce the error
if not eventName in ['PAINTED', 'UPDATEUI', 'MODIFIED']:
print(eventName)
initSCICallback(eventName) Run editor.clearCallbacks() to stop the error from happening