When to call NPPM_DESTROYSCINTILLAHANDLE ?
-
Hi everyone,
I’m working on a C# plugin and use NPPM_CREATESCINTILLAHANDLE to get a Scintilla instance.
It all works as expected, and as directed on the wiki Messages And Notifications page I call NPPM_DESTROYSCINTILLAHANDLE when I am done.
Thereafter NPP appears to work correctly, but soon crashes with an Access Violation when doing ScintillaEditView::attachDefaultDoc()… well away from my plugin which is by now dormant. If I skip the DESTROY call, the crash does not occur.
So is NPPM_DESTROYSCINTILLAHANDLE only intended to be called on Notepad++ shutdown?
Or is there some other action I need to take first?NB: This is running NPP and my plugin through VS2017 IDE debugger, and is currently using NPP v7.4.2 source (slightly modified)… so please just after general advice on the create/destroy handle thing before trying to isolate the error further.
Specifically the crash happens on the “isVisibile” line here:
size_t FileManager::nextUntitledNewNumber() const { std::vector<size_t> usedNumbers; for(size_t i = 0; i < _buffers.size(); i++) { Buffer *buf = _buffers.at(i); if (buf->isUntitled()) { // if untitled document is invisible, then don't put its number into array (so its number is available to be used) if ((buf->_referees[0])->isVisible()) ...
Cheers,
Moon