From 08f9f7fa2684d8171dc954aa6c92866b3946956f Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 16 Mar 2016 07:59:44 +1300 Subject: [PATCH] Make ErrorHandler optionally reference-counted This reference counting isn't currently used anywhere, but means we can hook it up in 1.4.x if ticket #3 gets addressed. See #186. --- xapian-core/include/xapian/errorhandler.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xapian-core/include/xapian/errorhandler.h b/xapian-core/include/xapian/errorhandler.h index 0bbeb309d..8daf76b3f 100644 --- a/xapian-core/include/xapian/errorhandler.h +++ b/xapian-core/include/xapian/errorhandler.h @@ -1,7 +1,7 @@ /** @file errorhandler.h * @brief Decide if a Xapian::Error exception should be ignored. */ -/* Copyright (C) 2003,2006,2007,2012,2013,2014 Olly Betts +/* Copyright (C) 2003,2006,2007,2012,2013,2014,2016 Olly Betts * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -27,6 +27,7 @@ #include #include +#include #include namespace Xapian { @@ -46,7 +47,8 @@ class Error; * also so that such errors can be logged and dead servers temporarily removed * from use). */ -class XAPIAN_VISIBILITY_DEFAULT ErrorHandler { +class XAPIAN_VISIBILITY_DEFAULT ErrorHandler + : public Xapian::Internal::opt_intrusive_base { /// Don't allow assignment. void operator=(const ErrorHandler &); @@ -92,6 +94,16 @@ class XAPIAN_VISIBILITY_DEFAULT ErrorHandler { * @param error The Xapian::Error object under consideration. */ void operator()(Xapian::Error &error); + + ErrorHandler * release() { + opt_intrusive_base::release(); + return this; + } + + const ErrorHandler * release() const { + opt_intrusive_base::release(); + return this; + } }; } -- 2.11.4.GIT