<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[When to call NPPM_DESTROYSCINTILLAHANDLE ?]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">I’m working on a C# plugin and use NPPM_CREATESCINTILLAHANDLE to get a Scintilla instance.</p>
<p dir="auto">It all works as expected, and as directed on the wiki <a href="http://docs.notepad-plus-plus.org/index.php/Messages_And_Notifications" rel="nofollow ugc">Messages And Notifications</a> page I call NPPM_DESTROYSCINTILLAHANDLE when I am done.</p>
<p dir="auto">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.</p>
<p dir="auto">So is NPPM_DESTROYSCINTILLAHANDLE only intended to be called on Notepad++ shutdown?<br />
Or is there some other action I need to take first?</p>
<p dir="auto">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.</p>
<p dir="auto">Specifically the crash happens on the “isVisibile” line here:</p>
<pre><code>size_t FileManager::nextUntitledNewNumber() const
{
  std::vector&lt;size_t&gt; usedNumbers;
  for(size_t i = 0; i &lt; _buffers.size(); i++)
  {
	Buffer *buf = _buffers.at(i);
	if (buf-&gt;isUntitled())
	{
		// if untitled document is invisible, then don't put its number into array (so its number is available to be used)
		if ((buf-&gt;_referees[0])-&gt;isVisible())
                   ...
</code></pre>
<p dir="auto">Cheers,<br />
Moon</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/14534/when-to-call-nppm_destroyscintillahandle</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 22:45:23 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/14534.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 27 Sep 2017 08:59:10 GMT</pubDate><ttl>60</ttl></channel></rss>