[Github-comments] [geany/geany] segfault responding to editor-notify when dragging a file onto Geany when only "untitled" is open (Issue #2998)

xiota notifications at xxxxx
Sat Nov 13 03:47:37 UTC 2021


In the following, the last `printf` to output before the segfault is `3 SCNotification`.  So apparently just testing `!editor->document->changed` is causing the segfault?
```
bool NewPluginClass::editor_notify(GObject *object, GeanyEditor *editor, SCNotification *nt, NewPluginClass *self) {
  if (!self->enable) {
    return false;
  }

  printf("1 SCNotification = %lu\n", (ulong)nt);
  if (!editor) {
    printf("1a SCNotification = %lu\n", (ulong)nt);
    return false;
  }

  printf("2 SCNotification = %lu\n", (ulong)nt);
  if (editor && !editor->document) {
    printf("2a SCNotification = %lu\n", (ulong)nt);
    return false;
  }

  printf("3 SCNotification = %lu\n", (ulong)nt);
  if (editor && editor->document && !editor->document->changed) {
    printf("3a SCNotification = %lu\n", (ulong)nt);
    return false;
  }

  printf("4 SCNotification = %lu\n", (ulong)nt);
  if (editor && !editor->sci) {
    printf("4a SCNotification = %lu\n", (ulong)nt);
    return false;
  }

  printf("5 SCNotification = %lu\n", (ulong)nt);
  if (editor && editor->sci && sci_get_length(editor->sci) == 0) {
    printf("5a SCNotification = %lu\n", (ulong)nt);
    return false;
  }
  return false;
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/2998#issuecomment-967773694
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211112/2808056f/attachment.htm>


More information about the Github-comments mailing list