Community
    • 登入

    When to call NPPM_DESTROYSCINTILLAHANDLE ?

    已排程 已置頂 已鎖定 已移動 Notepad++ & Plugin Development
    1 貼文 1 Posters 1.0k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • moon6969M
      moon6969
      最後由 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 條回覆 最後回覆 回覆 引用 0
      • 第一個貼文
        最後的貼文
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors