Yes agree, but any scenario that is possible _can_ occur, and the case of the
user closes document while dialog open has been reported already, and see #2599
for a non-KDE example.
Since we don't have many occurrences its not something that needs rushing into,
just put it on the eternal todo li
Yes, but I think (3) is really rare - closing documents is typically done by
users; if plugins do that, it would be very unexpected. That doesn't mean there
couldn't be some races like that when a user closes a document, opens another,
and only after that an asynchronous operation with a doc arg
> checking the ID would be better.
No, actually checking `id` is essential. I didn't really realise how much
until now. Consider for example the sequence:
1. Geany function gets `doc` pointer
2. does something that results in a signal
3. plugin callback is called by signal and it closes the do
@elextr Thanks for the answer.
> Document objects are never freed, so you will never get an invalid pointer,
> so thats one less worry. So no need to check if its in the document array, it
> will be.
Alright, that's the piece of information I was missing - I never actually
looked at the implem
Closed #3872 as completed.
--
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/issues/3872#event-12778480824
You are receiving this because you are subscribed to this thread.
Message ID:
Sigh, welcome to asynchronous programming and state changing beneath you.
> if the pointer to the doc was freed in the meantime, DOC_VALID() usage would
> lead to memory access over invalid pointer.
Document objects are never freed, so you will never get an invalid pointer, so
thats one less wo