db = _notmuch_rb_messages_db(messages);
}
else
- rb_bug("message's parent is neither database nor messages");
+ db = NULL;
return db;
}
db = _notmuch_rb_message_db(message);
}
else
- rb_bug("messages' parent is neither query nor thread nor message");
+ db = NULL;
return db;
}
{
notmuch_rb_database_t *db;
- Data_Get_Struct(dir->db, notmuch_rb_database_t, db);
+ if (rb_obj_is_instance_of(dir->db, notmuch_rb_cDatabase))
+ Data_Get_Struct(dir->db, notmuch_rb_database_t, db);
+ else
+ db = NULL;
- if (db->nm_db && dir->nm_dir)
+ if (db && db->nm_db && dir->nm_dir)
notmuch_directory_destroy(dir->nm_dir);
free(dir);
notmuch_rb_directory_t *dir;
notmuch_rb_database_t *db;
- Data_Get_Struct(flist->dir, notmuch_rb_directory_t, dir);
- Data_Get_Struct(dir->db, notmuch_rb_database_t, db);
+ if (rb_obj_is_instance_of(flist->dir, notmuch_rb_cDirectory)) {
+ Data_Get_Struct(flist->dir, notmuch_rb_directory_t, dir);
+ if (rb_obj_is_instance_of(dir->db, notmuch_rb_cDatabase))
+ Data_Get_Struct(dir->db, notmuch_rb_database_t, db);
+ else
+ db = NULL;
+ }
+ else
+ db = NULL;
- if (db->nm_db && flist->nm_flist)
+ if (db && db->nm_db && flist->nm_flist)
notmuch_filenames_destroy(flist->nm_flist);
free(flist);
{
notmuch_rb_database_t *db;
- Data_Get_Struct(query->db, notmuch_rb_database_t, db);
+ if (rb_obj_is_instance_of(query->db, notmuch_rb_cDatabase))
+ Data_Get_Struct(query->db, notmuch_rb_database_t, db);
+ else
+ db = NULL;
- if (db->nm_db && query->nm_query)
+ if (db && db->nm_db && query->nm_query)
notmuch_query_destroy(query->nm_query);
free(query);
notmuch_rb_query_t *query;
notmuch_rb_database_t *db;
- Data_Get_Struct(threads->query, notmuch_rb_query_t, query);
- Data_Get_Struct(query->db, notmuch_rb_database_t, db);
+ if (rb_obj_is_instance_of(threads->query, notmuch_rb_cQuery)) {
+ Data_Get_Struct(threads->query, notmuch_rb_query_t, query);
+ if (rb_obj_is_instance_of(query->db, notmuch_rb_cDatabase))
+ Data_Get_Struct(query->db, notmuch_rb_database_t, db);
+ else
+ db = NULL;
+ }
+ else
+ db = NULL;
- if (db->nm_db && threads->nm_threads)
+ if (db && db->nm_db && threads->nm_threads)
notmuch_threads_destroy(threads->nm_threads);
free(threads);
db = _notmuch_rb_messages_db(messages);
- if (db->nm_db && messages->nm_messages)
+ if (db && db->nm_db && messages->nm_messages)
notmuch_messages_destroy(messages->nm_messages);
free(messages);
db = _notmuch_rb_thread_db(thread);
- if (db->nm_db && thread->nm_thread)
+ if (db && db->nm_db && thread->nm_thread)
notmuch_thread_destroy(thread->nm_thread);
free(thread);
notmuch_rb_database_t *db;
db = _notmuch_rb_message_db(message);
- if (db->nm_db && message->nm_message)
+ if (db && db->nm_db && message->nm_message)
notmuch_message_destroy(message->nm_message);
free(message);
db = _notmuch_rb_messages_db(messages);
}
else
- rb_bug("tags' parent is neither thread nor message nor messages");
+ return;
- if (db->nm_db && tags->nm_tags)
+ if (db && db->nm_db && tags->nm_tags)
notmuch_tags_destroy(tags->nm_tags);
free(tags);