<p></p>
<p dir="auto">I'm getting a segfault when calling <code>sci_get_length(editor->sci)</code> in a function responding to an <code>editor-notify</code> signal.  This occurs only when dropping files into Geany when no documents are open (the only document is "untitled").  This problem does not occur when:</p>
<ul dir="auto">
<li>Double clicking a file in the file manager</li>
<li>Dragging a file when other documents are open</li>
<li>Draggin a file after modifying the untitled document</li>
</ul>
<p dir="auto">Checking that <code>editor</code>, <code>editor->document</code>, and <code>editor->sci</code> are not <code>NULL</code> does not prevent the segfault.</p>
<div class="highlight highlight-source-c"><pre><span class="pl-k">bool</span> <span class="pl-en">NewPluginClass::editor_notify</span>(GObject *object, GeanyEditor *editor, SCNotification *nt, NewPluginClass *self) {
  <span class="pl-k">if</span> (!self-><span class="pl-smi">enable</span> || !<span class="pl-c1">DOC_VALID</span>(editor-><span class="pl-smi">document</span>) || !editor-><span class="pl-smi">document</span>-><span class="pl-smi">changed</span>) {
    <span class="pl-k">return</span> <span class="pl-c1">false</span>;
  }

  <span class="pl-k">if</span> (editor && editor-><span class="pl-smi">sci</span> && <span class="pl-c1">sci_get_length</span>(editor-><span class="pl-smi">sci</span>) == <span class="pl-c1">0</span>) {
    <span class="pl-c"><span class="pl-c">//</span> testing</span>
  }

  <span class="pl-k">return</span> <span class="pl-c1">false</span>;
}</pre></div>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/2998">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ2DXVZK3MDQY22E4JLULXJLVANCNFSM5H6DYIIQ">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<img src="https://github.com/notifications/beacon/AAIOWJ5XVS3FK7VTJNWYTETULXJLVA5CNFSM5H6DYII2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4PV4KENQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/issues/2998",
"url": "https://github.com/geany/geany/issues/2998",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>