ScintillaDocument::~ScintillaDocument() { Document *doc = static_cast<Document *>(pdoc); if (doc) { doc->RemoveWatcher(docWatcher, doc); doc->Release(); } pdoc = NULL; delete docWatcher; docWatcher = NULL; }