diff --git a/ChangeLog b/ChangeLog index f9cf6381..01c05564 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * src/msgwindow.c: Fix a segfault after clicking on a messages window Find Usage item after the relevant document has been closed. + * src/msgwindow.c, src/document.h: + Move DOC_VALID() macro to document.h, add dox. 2008-06-12 Enrico Tröger diff --git a/src/document.h b/src/document.h index b2c35a8c..b6be7e58 100644 --- a/src/document.h +++ b/src/document.h @@ -130,6 +130,14 @@ extern GPtrArray *documents_array; **/ #define documents ((GeanyDocument **)documents_array->pdata) +/** Check that the @a doc_ptr document still exists (has not been closed). + * This is useful when @a doc_ptr was stored some time earlier and documents may have been + * closed since then. + * @note This should not be used to check the result of the main API functions, + * these only need a NULL-pointer check - @c p_document->get_current() != @c NULL. */ +#define DOC_VALID(doc_ptr) \ + ((doc_ptr) != NULL && (doc_ptr)->is_valid) + /** NULL-safe way to get the index of @a doc_ptr in the documents array. */ #define DOC_IDX(doc_ptr) \ (doc_ptr ? doc_ptr->index : -1) diff --git a/src/msgwindow.c b/src/msgwindow.c index 3126d488..f7ddcd8c 100644 --- a/src/msgwindow.c +++ b/src/msgwindow.c @@ -791,9 +791,6 @@ void msgwin_parse_compiler_error_line(const gchar *string, const gchar *dir, gch } -#define DOC_VALID(doc_ptr) \ - ((doc_ptr) != NULL && (doc_ptr)->is_valid) - gboolean msgwin_goto_messages_file_line() { GtkTreeIter iter;