Community
    • Login

    When to call NPPM_DESTROYSCINTILLAHANDLE ?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    1 Posts 1 Posters 1.2k Views 1 Watching
    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 Offline
      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

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors