Community
    • Login

    When to call NPPM_DESTROYSCINTILLAHANDLE ?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    1 Posts 1 Posters 1.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • moon6969M
      moon6969
      last edited by moon6969

      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

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors