summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2016-04-10 11:25:29 +0200
committerMurray Cumming <murrayc@murrayc.com>2016-11-19 21:34:47 +0100
commit543b443d683eb5570ffac26b4a381cb1f59834a0 (patch)
treee246ba3dd053e386059f6e5187466efcbfc015f7
parentb420a11cf79e24cc349fa9489433e1cb1915bfa3 (diff)
downloadglibmm-543b443d683eb5570ffac26b4a381cb1f59834a0.tar.gz
Add and use make_refptr_for_instance().
-rw-r--r--gio/giomm/socketsource.cc2
-rw-r--r--gio/src/asyncresult.ccg2
-rw-r--r--gio/src/bufferedinputstream.ccg2
-rw-r--r--gio/src/bufferedoutputstream.ccg2
-rw-r--r--gio/src/dbusconnection.ccg16
-rw-r--r--gio/src/dbusproxy.ccg8
-rw-r--r--gio/src/dbusserver.ccg8
-rw-r--r--gio/src/socket.ccg4
-rw-r--r--gio/src/tlscertificate.ccg2
-rw-r--r--glib/glibmm/containerhandle_shared.h4
-rw-r--r--glib/glibmm/interface.cc2
-rw-r--r--glib/glibmm/main.cc18
-rw-r--r--glib/glibmm/object.h8
-rw-r--r--glib/glibmm/refptr.h7
-rw-r--r--glib/glibmm/value.cc2
-rw-r--r--glib/glibmm/wrap.cc2
-rw-r--r--glib/src/balancedtree.hg4
-rw-r--r--glib/src/binding.ccg2
-rw-r--r--glib/src/bytearray.hg2
-rw-r--r--glib/src/iochannel.ccg2
-rw-r--r--tools/m4/class_gobject.m44
-rw-r--r--tools/m4/class_interface.m42
-rw-r--r--tools/m4/class_opaque_refcounted.m44
23 files changed, 58 insertions, 51 deletions
diff --git a/gio/giomm/socketsource.cc b/gio/giomm/socketsource.cc
index 42842616..2dc275f0 100644
--- a/gio/giomm/socketsource.cc
+++ b/gio/giomm/socketsource.cc
@@ -89,7 +89,7 @@ Glib::RefPtr<SocketSource>
SocketSource::create(const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition,
const Glib::RefPtr<Cancellable>& cancellable)
{
- return Glib::RefPtr<SocketSource>(new SocketSource(socket, condition, cancellable));
+ return Glib::make_refptr_for_instance<SocketSource>(new SocketSource(socket, condition, cancellable));
}
SocketSource::SocketSource(const Glib::RefPtr<Socket>& socket, Glib::IOCondition condition,
diff --git a/gio/src/asyncresult.ccg b/gio/src/asyncresult.ccg
index 252fb872..bebc7abd 100644
--- a/gio/src/asyncresult.ccg
+++ b/gio/src/asyncresult.ccg
@@ -35,7 +35,7 @@ AsyncResult::get_source_object_base()
{
auto cobj = g_async_result_get_source_object(gobj());
auto cppobj = Glib::wrap_auto(cobj); // ObjectBase::_get_current_wrapper(cobj);
- return Glib::RefPtr<Glib::ObjectBase>(
+ return Glib::make_refptr_for_instance<Glib::ObjectBase>(
cppobj); // g_async_result_get_source_object() gives us a ref, unusually.
// TODO: For some reason this fails: Glib::wrap(cobj);
}
diff --git a/gio/src/bufferedinputstream.ccg b/gio/src/bufferedinputstream.ccg
index 862db1c5..888b7afc 100644
--- a/gio/src/bufferedinputstream.ccg
+++ b/gio/src/bufferedinputstream.ccg
@@ -26,7 +26,7 @@ namespace Gio
Glib::RefPtr<BufferedInputStream>
BufferedInputStream::create_sized(const Glib::RefPtr<InputStream>& base_stream, gsize buffer_size)
{
- return Glib::RefPtr<Gio::BufferedInputStream>(new BufferedInputStream(base_stream, buffer_size));
+ return Glib::make_refptr_for_instance<Gio::BufferedInputStream>(new BufferedInputStream(base_stream, buffer_size));
}
void
diff --git a/gio/src/bufferedoutputstream.ccg b/gio/src/bufferedoutputstream.ccg
index 3985649b..c5497759 100644
--- a/gio/src/bufferedoutputstream.ccg
+++ b/gio/src/bufferedoutputstream.ccg
@@ -26,7 +26,7 @@ namespace Gio
Glib::RefPtr<BufferedOutputStream>
BufferedOutputStream::create_sized(const Glib::RefPtr<OutputStream>& base_stream, gsize size)
{
- return Glib::RefPtr<Gio::BufferedOutputStream>(new BufferedOutputStream(base_stream, size));
+ return Glib::make_refptr_for_instance<Gio::BufferedOutputStream>(new BufferedOutputStream(base_stream, size));
}
} // namespace Gio
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index 557d6958..5fe37d91 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -279,7 +279,7 @@ Connection::create_sync(const Glib::RefPtr<IOStream>& stream, const std::string&
const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable,
ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(stream, guid, observer, cancellable, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(stream, guid, observer, cancellable, flags));
}
// static
@@ -287,7 +287,7 @@ Glib::RefPtr<Connection>
Connection::create_sync(const Glib::RefPtr<IOStream>& stream, const std::string& guid,
const Glib::RefPtr<Cancellable>& cancellable, ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(stream, guid, cancellable, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(stream, guid, cancellable, flags));
}
// static
@@ -295,7 +295,7 @@ Glib::RefPtr<Connection>
Connection::create_sync(const Glib::RefPtr<IOStream>& stream, const std::string& guid,
const Glib::RefPtr<AuthObserver>& observer, ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(stream, guid, observer, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(stream, guid, observer, flags));
}
// static
@@ -303,7 +303,7 @@ Glib::RefPtr<Connection>
Connection::create_sync(
const Glib::RefPtr<IOStream>& stream, const std::string& guid, ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(stream, guid, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(stream, guid, flags));
}
// static
@@ -353,7 +353,7 @@ Connection::create_for_address_sync(const std::string& address,
const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable,
ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(address, observer, cancellable, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(address, observer, cancellable, flags));
}
// static
@@ -361,7 +361,7 @@ Glib::RefPtr<Connection>
Connection::create_for_address_sync(
const std::string& address, const Glib::RefPtr<Cancellable>& cancellable, ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(address, cancellable, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(address, cancellable, flags));
}
// static
@@ -369,14 +369,14 @@ Glib::RefPtr<Connection>
Connection::create_for_address_sync(
const std::string& address, const Glib::RefPtr<AuthObserver>& observer, ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(address, observer, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(address, observer, flags));
}
// static
Glib::RefPtr<Connection>
Connection::create_for_address_sync(const std::string& address, ConnectionFlags flags)
{
- return Glib::RefPtr<Connection>(new Connection(address, flags));
+ return Glib::make_refptr_for_instance<Connection>(new Connection(address, flags));
}
// static
diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg
index b13f92f0..4bc9ecd7 100644
--- a/gio/src/dbusproxy.ccg
+++ b/gio/src/dbusproxy.ccg
@@ -146,7 +146,7 @@ Proxy::create_sync(const Glib::RefPtr<Connection>& connection, const Glib::ustri
const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<InterfaceInfo>& info,
ProxyFlags flags)
{
- return Glib::RefPtr<Proxy>(
+ return Glib::make_refptr_for_instance<Proxy>(
new Proxy(connection, name, object_path, interface_name, cancellable, info, flags));
}
@@ -155,7 +155,7 @@ Proxy::create_sync(const Glib::RefPtr<Connection>& connection, const Glib::ustri
const Glib::ustring& object_path, const Glib::ustring& interface_name,
const Glib::RefPtr<InterfaceInfo>& info, ProxyFlags flags)
{
- return Glib::RefPtr<Proxy>(new Proxy(connection, name, object_path, interface_name, info, flags));
+ return Glib::make_refptr_for_instance<Proxy>(new Proxy(connection, name, object_path, interface_name, info, flags));
}
void
@@ -181,7 +181,7 @@ Proxy::create_for_bus_sync(BusType bus_type, const Glib::ustring& name,
const Glib::RefPtr<Cancellable>& cancellable, const Glib::RefPtr<InterfaceInfo>& info,
ProxyFlags flags)
{
- return Glib::RefPtr<Proxy>(
+ return Glib::make_refptr_for_instance<Proxy>(
new Proxy(bus_type, name, object_path, interface_name, cancellable, info, flags));
}
@@ -190,7 +190,7 @@ Proxy::create_for_bus_sync(BusType bus_type, const Glib::ustring& name,
const Glib::ustring& object_path, const Glib::ustring& interface_name,
const Glib::RefPtr<InterfaceInfo>& info, ProxyFlags flags)
{
- return Glib::RefPtr<Proxy>(new Proxy(bus_type, name, object_path, interface_name, info, flags));
+ return Glib::make_refptr_for_instance<Proxy>(new Proxy(bus_type, name, object_path, interface_name, info, flags));
}
void
diff --git a/gio/src/dbusserver.ccg b/gio/src/dbusserver.ccg
index 2d6aea8d..71347378 100644
--- a/gio/src/dbusserver.ccg
+++ b/gio/src/dbusserver.ccg
@@ -68,27 +68,27 @@ Server::create_sync(const std::string& address, const std::string& guid,
const Glib::RefPtr<AuthObserver>& observer, const Glib::RefPtr<Cancellable>& cancellable,
ServerFlags flags)
{
- return Glib::RefPtr<Server>(new Server(address, guid, observer, cancellable, flags));
+ return Glib::make_refptr_for_instance<Server>(new Server(address, guid, observer, cancellable, flags));
}
Glib::RefPtr<Server>
Server::create_sync(const std::string& address, const std::string& guid,
const Glib::RefPtr<Cancellable>& cancellable, ServerFlags flags)
{
- return Glib::RefPtr<Server>(new Server(address, guid, cancellable, flags));
+ return Glib::make_refptr_for_instance<Server>(new Server(address, guid, cancellable, flags));
}
Glib::RefPtr<Server>
Server::create_sync(const std::string& address, const std::string& guid,
const Glib::RefPtr<AuthObserver>& observer, ServerFlags flags)
{
- return Glib::RefPtr<Server>(new Server(address, guid, observer, flags));
+ return Glib::make_refptr_for_instance<Server>(new Server(address, guid, observer, flags));
}
Glib::RefPtr<Server>
Server::create_sync(const std::string& address, const std::string& guid, ServerFlags flags)
{
- return Glib::RefPtr<Server>(new Server(address, guid, flags));
+ return Glib::make_refptr_for_instance<Server>(new Server(address, guid, flags));
}
} // namespace DBus
diff --git a/gio/src/socket.ccg b/gio/src/socket.ccg
index 6dfd71ee..21f54732 100644
--- a/gio/src/socket.ccg
+++ b/gio/src/socket.ccg
@@ -43,14 +43,14 @@ Glib::RefPtr<Socket>
Socket::create(SocketFamily family, SocketType type, SocketProtocol protocol,
const Glib::RefPtr<Cancellable>& cancellable)
{
- return Glib::RefPtr<Socket>(new Socket(family, type, protocol, cancellable));
+ return Glib::make_refptr_for_instance<Socket>(new Socket(family, type, protocol, cancellable));
}
// static
Glib::RefPtr<Socket>
Socket::create_from_fd(int fd, const Glib::RefPtr<Cancellable>& cancellable)
{
- return Glib::RefPtr<Socket>(new Socket(fd, cancellable));
+ return Glib::make_refptr_for_instance<Socket>(new Socket(fd, cancellable));
}
gssize
diff --git a/gio/src/tlscertificate.ccg b/gio/src/tlscertificate.ccg
index 448757fb..2df281eb 100644
--- a/gio/src/tlscertificate.ccg
+++ b/gio/src/tlscertificate.ccg
@@ -25,7 +25,7 @@ namespace Gio
Glib::RefPtr<TlsCertificate>
TlsCertificate::create_from_pem(const std::string& data, gssize length)
{
- return Glib::RefPtr<TlsCertificate>(new TlsCertificate(data, length));
+ return Glib::make_refptr_for_instance<TlsCertificate>(new TlsCertificate(data, length));
}
} // namesapce Gio
diff --git a/glib/glibmm/containerhandle_shared.h b/glib/glibmm/containerhandle_shared.h
index dffce99b..c7543e6c 100644
--- a/glib/glibmm/containerhandle_shared.h
+++ b/glib/glibmm/containerhandle_shared.h
@@ -206,7 +206,7 @@ struct TypeTraits<Glib::RefPtr<T>>
// because that would be "dependent", and g++ 3.4 does not allow that.
// The specific Glib::wrap() overloads don't do anything special anyway.
GObject* cobj = (GObject*)(ptr);
- return Glib::RefPtr<T>(dynamic_cast<T*>(Glib::wrap_auto(cobj, true /* take_copy */)));
+ return Glib::make_refptr_for_instance<T>(dynamic_cast<T*>(Glib::wrap_auto(cobj, true /* take_copy */)));
// We use dynamic_cast<> in case of multiple inheritance.
}
@@ -242,7 +242,7 @@ struct TypeTraits<Glib::RefPtr<const T>>
// because that would be "dependent", and g++ 3.4 does not allow that.
// The specific Glib::wrap() overloads don't do anything special anyway.
GObject* cobj = (GObject*)const_cast<CTypeNonConst>(ptr);
- return Glib::RefPtr<const T>(
+ return Glib::make_refptr_for_instance<const T>(
dynamic_cast<const T*>(Glib::wrap_auto(cobj, true /* take_copy */)));
// We use dynamic_cast<> in case of multiple inheritance.
}
diff --git a/glib/glibmm/interface.cc b/glib/glibmm/interface.cc
index 0ce998bf..7879afe0 100644
--- a/glib/glibmm/interface.cc
+++ b/glib/glibmm/interface.cc
@@ -157,7 +157,7 @@ Interface::get_base_type()
RefPtr<ObjectBase>
wrap_interface(GObject* object, bool take_copy)
{
- return Glib::RefPtr<ObjectBase>(wrap_auto(object, take_copy));
+ return Glib::make_refptr_for_instance<ObjectBase>(wrap_auto(object, take_copy));
}
} // namespace Glib
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index 27464d3e..f254b8c1 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -565,7 +565,7 @@ signal_child_watch()
Glib::RefPtr<MainContext>
MainContext::create()
{
- return Glib::RefPtr<MainContext>(reinterpret_cast<MainContext*>(g_main_context_new()));
+ return Glib::make_refptr_for_instance<MainContext>(reinterpret_cast<MainContext*>(g_main_context_new()));
}
// static
@@ -747,7 +747,7 @@ wrap(GMainContext* gobject, bool take_copy)
if (take_copy && gobject)
g_main_context_ref(gobject);
- return Glib::RefPtr<MainContext>(reinterpret_cast<MainContext*>(gobject));
+ return Glib::make_refptr_for_instance<MainContext>(reinterpret_cast<MainContext*>(gobject));
}
/**** Glib::MainLoop *******************************************************/
@@ -755,13 +755,13 @@ wrap(GMainContext* gobject, bool take_copy)
Glib::RefPtr<MainLoop>
MainLoop::create(bool is_running)
{
- return Glib::RefPtr<MainLoop>(reinterpret_cast<MainLoop*>(g_main_loop_new(nullptr, is_running)));
+ return Glib::make_refptr_for_instance<MainLoop>(reinterpret_cast<MainLoop*>(g_main_loop_new(nullptr, is_running)));
}
Glib::RefPtr<MainLoop>
MainLoop::create(const Glib::RefPtr<MainContext>& context, bool is_running)
{
- return Glib::RefPtr<MainLoop>(
+ return Glib::make_refptr_for_instance<MainLoop>(
reinterpret_cast<MainLoop*>(g_main_loop_new(Glib::unwrap(context), is_running)));
}
@@ -833,7 +833,7 @@ wrap(GMainLoop* gobject, bool take_copy)
if (take_copy && gobject)
g_main_loop_ref(gobject);
- return Glib::RefPtr<MainLoop>(reinterpret_cast<MainLoop*>(gobject));
+ return Glib::make_refptr_for_instance<MainLoop>(reinterpret_cast<MainLoop*>(gobject));
}
/**** Glib::Source *********************************************************/
@@ -1134,7 +1134,7 @@ Source::get_slot_from_callback_data(void* data)
Glib::RefPtr<TimeoutSource>
TimeoutSource::create(unsigned int interval)
{
- return Glib::RefPtr<TimeoutSource>(new TimeoutSource(interval));
+ return Glib::make_refptr_for_instance<TimeoutSource>(new TimeoutSource(interval));
}
sigc::connection
@@ -1219,7 +1219,7 @@ TimeoutSource::dispatch(sigc::slot_base* slot)
Glib::RefPtr<IdleSource>
IdleSource::create()
{
- return Glib::RefPtr<IdleSource>(new IdleSource());
+ return Glib::make_refptr_for_instance<IdleSource>(new IdleSource());
}
sigc::connection
@@ -1262,13 +1262,13 @@ IdleSource::dispatch(sigc::slot_base* slot)
Glib::RefPtr<IOSource>
IOSource::create(int fd, IOCondition condition)
{
- return Glib::RefPtr<IOSource>(new IOSource(fd, condition));
+ return Glib::make_refptr_for_instance<IOSource>(new IOSource(fd, condition));
}
Glib::RefPtr<IOSource>
IOSource::create(const Glib::RefPtr<IOChannel>& channel, IOCondition condition)
{
- return Glib::RefPtr<IOSource>(new IOSource(channel, condition));
+ return Glib::make_refptr_for_instance<IOSource>(new IOSource(channel, condition));
}
sigc::connection
diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h
index 3ff39b03..01816198 100644
--- a/glib/glibmm/object.h
+++ b/glib/glibmm/object.h
@@ -186,7 +186,7 @@ struct TypeTraits<Glib::RefPtr<T>>
// because that would be "dependent", and g++ 3.4 does not allow that.
// The specific Glib::wrap() overloads don't do anything special anyway.
GObject* cobj = (GObject*)const_cast<CTypeNonConst>(ptr);
- return Glib::RefPtr<T>(dynamic_cast<T*>(Glib::wrap_auto(cobj, true /* take_copy */)));
+ return Glib::make_refptr_for_instance<T>(dynamic_cast<T*>(Glib::wrap_auto(cobj, true /* take_copy */)));
// We use dynamic_cast<> in case of multiple inheritance.
}
@@ -222,7 +222,7 @@ struct TypeTraits<Glib::RefPtr<const T>>
// because that would be "dependent", and g++ 3.4 does not allow that.
// The specific Glib::wrap() overloads don't do anything special anyway.
GObject* cobj = (GObject*)(ptr);
- return Glib::RefPtr<const T>(
+ return Glib::make_refptr_for_instance<const T>(
dynamic_cast<const T*>(Glib::wrap_auto(cobj, true /* take_copy */)));
// We use dynamic_cast<> in case of multiple inheritance.
}
@@ -258,7 +258,7 @@ public:
static GType value_type() { return T::get_base_type(); }
void set(const CppType& data) { set_object(data.operator->()); }
- CppType get() const { return Glib::RefPtr<T>::cast_dynamic(get_object_copy()); }
+ CppType get() const { return Glib::make_refptr_for_instance<T>::cast_dynamic(get_object_copy()); }
};
// The SUN Forte Compiler has a problem with this:
@@ -277,7 +277,7 @@ public:
static GType value_type() { return T::get_base_type(); }
void set(const CppType& data) { set_object(const_cast<T*>(data.operator->())); }
- CppType get() const { return Glib::RefPtr<T>::cast_dynamic(get_object_copy()); }
+ CppType get() const { return Glib::make_refptr_for_instance<T>::cast_dynamic(get_object_copy()); }
};
#endif /* GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS */
diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h
index 892b6a67..4ded0b7a 100644
--- a/glib/glibmm/refptr.h
+++ b/glib/glibmm/refptr.h
@@ -505,6 +505,13 @@ swap(RefPtr<T_CppObject>& lhs, RefPtr<T_CppObject>& rhs) noexcept
lhs.swap(rhs);
}
+template <class T_CppObject>
+RefPtr<T_CppObject>
+make_refptr_for_instance(T_CppObject* object)
+{
+ return RefPtr<T_CppObject>(object);
+}
+
} // namespace Glib
#endif /* _GLIBMM_REFPTR_H */
diff --git a/glib/glibmm/value.cc b/glib/glibmm/value.cc
index ef68fcef..893bb859 100644
--- a/glib/glibmm/value.cc
+++ b/glib/glibmm/value.cc
@@ -138,7 +138,7 @@ Glib::RefPtr<Glib::ObjectBase>
ValueBase_Object::get_object_copy() const
{
GObject* const data = static_cast<GObject*>(g_value_get_object(&gobject_));
- return Glib::RefPtr<Glib::ObjectBase>(Glib::wrap_auto(data, true));
+ return Glib::make_refptr_for_instance<Glib::ObjectBase>(Glib::wrap_auto(data, true));
}
GParamSpec*
diff --git a/glib/glibmm/wrap.cc b/glib/glibmm/wrap.cc
index f30fea95..ee9ca797 100644
--- a/glib/glibmm/wrap.cc
+++ b/glib/glibmm/wrap.cc
@@ -216,7 +216,7 @@ wrap_auto(GObject* object, bool take_copy)
Glib::RefPtr<Object>
wrap(GObject* object, bool take_copy /* = false */)
{
- return Glib::RefPtr<Object>(dynamic_cast<Object*>(wrap_auto(object, take_copy)));
+ return Glib::make_refptr_for_instance<Object>(dynamic_cast<Object*>(wrap_auto(object, take_copy)));
}
} /* namespace Glib */
diff --git a/glib/src/balancedtree.hg b/glib/src/balancedtree.hg
index 5444046a..13158ef0 100644
--- a/glib/src/balancedtree.hg
+++ b/glib/src/balancedtree.hg
@@ -78,12 +78,12 @@ protected:
public:
static Glib::RefPtr< BalancedTree<K, V> > create()
{
- return Glib::RefPtr< BalancedTree<K, V> >(new BalancedTree());
+ return Glib::make_refptr_for_instance< BalancedTree<K, V> >(new BalancedTree());
}
static Glib::RefPtr< BalancedTree<K, V> > create(const CompareFunc &key_compare_slot)
{
- return Glib::RefPtr< BalancedTree<K, V> >(new BalancedTree(key_compare_slot));
+ return Glib::make_refptr_for_instance< BalancedTree<K, V> >(new BalancedTree(key_compare_slot));
}
~BalancedTree()
diff --git a/glib/src/binding.ccg b/glib/src/binding.ccg
index 576b64f6..7d660297 100644
--- a/glib/src/binding.ccg
+++ b/glib/src/binding.ccg
@@ -112,7 +112,7 @@ Binding::bind_property_value(const PropertyProxy_Base& source_property,
// either the source object or the target object is finalized.
// The GBinding object must not be destroyed while there are RefPtrs around.
g_object_ref(binding);
- return Glib::RefPtr<Binding>(new Binding(binding));
+ return Glib::make_refptr_for_instance<Binding>(new Binding(binding));
}
void
diff --git a/glib/src/bytearray.hg b/glib/src/bytearray.hg
index 1e657b5c..3ed2d698 100644
--- a/glib/src/bytearray.hg
+++ b/glib/src/bytearray.hg
@@ -104,7 +104,7 @@ class Value< Glib::RefPtr<Glib::ByteArray> > : public ValueBase_Boxed
public:
static GType value_type() { return Glib::ByteArray::get_type(); }
void set(const Glib::RefPtr<Glib::ByteArray>& array) { set_boxed(Glib::unwrap(array)); }
- Glib::RefPtr<Glib::ByteArray> get() { return Glib::RefPtr<Glib::ByteArray>(reinterpret_cast<Glib::ByteArray*>(get_boxed())); }
+ Glib::RefPtr<Glib::ByteArray> get() { return make_refptr_for_instance<Glib::ByteArray>(reinterpret_cast<Glib::ByteArray*>(get_boxed())); }
};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
diff --git a/glib/src/iochannel.ccg b/glib/src/iochannel.ccg
index 7577a846..a071ba34 100644
--- a/glib/src/iochannel.ccg
+++ b/glib/src/iochannel.ccg
@@ -421,7 +421,7 @@ wrap(GIOChannel* gobject, bool take_copy)
}
}
- return Glib::RefPtr<IOChannel>(cpp_object);
+ return Glib::make_refptr_for_instance<IOChannel>(cpp_object);
}
/**** Glib::GlibmmIOChannel ************************************************/
diff --git a/tools/m4/class_gobject.m4 b/tools/m4/class_gobject.m4
index 0e0e4f6e..ff075050 100644
--- a/tools/m4/class_gobject.m4
+++ b/tools/m4/class_gobject.m4
@@ -105,7 +105,7 @@ define(`_CREATE_METHOD',`
_PUSH(SECTION_CC)
Glib::RefPtr<`'__CPPNAME__`'> __CPPNAME__`'::create(`'$2`')
{
- return Glib::RefPtr<`'__CPPNAME__`'>( new __CPPNAME__`'(`'$3`') );
+ return Glib::make_refptr_for_instance<`'__CPPNAME__`'>( new __CPPNAME__`'(`'$3`') );
}
_POP()
@@ -169,7 +169,7 @@ namespace Glib
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__REAL_CNAME__`'* object, bool take_copy)
{
- return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
+ return Glib::make_refptr_for_instance<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
//We use dynamic_cast<> in case of multiple inheritance.
}
diff --git a/tools/m4/class_interface.m4 b/tools/m4/class_interface.m4
index 3c0b93ef..bce51ffd 100644
--- a/tools/m4/class_interface.m4
+++ b/tools/m4/class_interface.m4
@@ -161,7 +161,7 @@ namespace Glib
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__`'* object, bool take_copy)
{
- return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto_interface<__NAMESPACE__::__CPPNAME__> ((GObject*)(object), take_copy)) );
+ return Glib::make_refptr_for_instance<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto_interface<__NAMESPACE__::__CPPNAME__> ((GObject*)(object), take_copy)) );
//We use dynamic_cast<> in case of multiple inheritance.
}
diff --git a/tools/m4/class_opaque_refcounted.m4 b/tools/m4/class_opaque_refcounted.m4
index e90a1c0d..41fbc5a1 100644
--- a/tools/m4/class_opaque_refcounted.m4
+++ b/tools/m4/class_opaque_refcounted.m4
@@ -66,7 +66,7 @@ Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__* object, bool take_copy)
__OPAQUE_FUNC_REF`'(object);
// See the comment at the top of this file, if you want to know why the cast works.
- return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>(reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object));
+ return Glib::make_refptr_for_instance<__NAMESPACE__::__CPPNAME__>(reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object));
}
} // namespace Glib
@@ -84,7 +84,7 @@ ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
Glib::RefPtr<__CPPNAME__> __CPPNAME__::create()
{
// See the comment at the top of this file, if you want to know why the cast works.
- return Glib::RefPtr<__CPPNAME__>(reinterpret_cast<__CPPNAME__*>(__OPAQUE_FUNC_NEW`'()));
+ return Glib::make_refptr_for_instance<__CPPNAME__>(reinterpret_cast<__CPPNAME__*>(__OPAQUE_FUNC_NEW`'()));
}
')dnl endif __OPAQUE_FUNC_NEW