diff --git a/addons/src/addons.c b/addons/src/addons.c index 638fd013a..8dac0bf7e 100644 --- a/addons/src/addons.c +++ b/addons/src/addons.c @@ -137,7 +137,7 @@ static gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor, static void ao_update_editor_menu_cb(GObject *obj, const gchar *word, gint pos, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_open_uri_update_menu(ao_info->openuri, doc, pos); } @@ -145,7 +145,7 @@ static void ao_update_editor_menu_cb(GObject *obj, const gchar *word, gint pos, static void ao_document_activate_cb(GObject *obj, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_bookmark_list_update(ao_info->bookmarklist, doc); ao_tasks_update_single(ao_info->tasks, doc); @@ -154,7 +154,7 @@ static void ao_document_activate_cb(GObject *obj, GeanyDocument *doc, gpointer d static void ao_document_new_cb(GObject *obj, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_mark_document_new(ao_info->markword, doc); ao_color_tip_document_new(ao_info->colortip, doc); @@ -163,7 +163,7 @@ static void ao_document_new_cb(GObject *obj, GeanyDocument *doc, gpointer data) static void ao_document_open_cb(GObject *obj, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_tasks_update(ao_info->tasks, doc); ao_mark_document_open(ao_info->markword, doc); @@ -173,7 +173,7 @@ static void ao_document_open_cb(GObject *obj, GeanyDocument *doc, gpointer data) static void ao_document_close_cb(GObject *obj, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_tasks_remove(ao_info->tasks, doc); ao_mark_document_close(ao_info->markword, doc); @@ -183,7 +183,7 @@ static void ao_document_close_cb(GObject *obj, GeanyDocument *doc, gpointer data static void ao_document_save_cb(GObject *obj, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_tasks_update(ao_info->tasks, doc); } @@ -191,7 +191,7 @@ static void ao_document_save_cb(GObject *obj, GeanyDocument *doc, gpointer data) static void ao_document_before_save_cb(GObject *obj, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_blanklines_on_document_before_save(obj, doc, data); } @@ -199,7 +199,7 @@ static void ao_document_before_save_cb(GObject *obj, GeanyDocument *doc, gpointe static void ao_document_reload_cb(GObject *obj, GeanyDocument *doc, gpointer data) { - g_return_if_fail(doc != NULL && doc->is_valid); + g_return_if_fail(DOC_VALID(doc)); ao_tasks_update(ao_info->tasks, doc); } diff --git a/addons/src/ao_tasks.c b/addons/src/ao_tasks.c index b7a0f9ed2..0cee91ec9 100644 --- a/addons/src/ao_tasks.c +++ b/addons/src/ao_tasks.c @@ -580,7 +580,7 @@ static gboolean update_tasks_for_doc_idle_cb(gpointer data) priv = AO_TASKS_GET_PRIVATE(arguments->t); doc = arguments->doc; - if (doc->is_valid && priv->active && priv->enable_tasks) + if (DOC_VALID(doc) && priv->active && priv->enable_tasks) { if (arguments->clear) ao_tasks_remove(arguments->t, doc); @@ -641,7 +641,7 @@ static void update_tasks_for_doc(AoTasks *t, GeanyDocument *doc, gboolean clear) arguments->doc = doc; arguments->clear = clear; - if (!doc->is_valid) + if (!DOC_VALID(doc)) return; /* Check for task tokens in an idle callback to wait until Geany applied Scintilla highlighting