gst: Use G_DEFINE_TYPE and don't call g_thread_init() from class_init

class_init is too late for calling g_thread_init() as g_thread_init()
needs to be called before any GObject function.
This commit is contained in:
Sebastian Dröge 2009-04-04 10:18:42 +02:00
parent 66295d508b
commit 42febffe0d
2 changed files with 5 additions and 65 deletions

View file

@ -99,37 +99,12 @@ static guint gst_bus_signals[LAST_SIGNAL] = { 0 };
struct _GstBusPrivate
{
guint num_sync_message_emitters;
GCond *queue_cond;
GSource *watch_id;
GMainContext *main_context;
};
GType
gst_bus_get_type (void)
{
static GType bus_type = 0;
if (G_UNLIKELY (bus_type == 0)) {
static const GTypeInfo bus_info = {
sizeof (GstBusClass),
NULL,
NULL,
(GClassInitFunc) gst_bus_class_init,
NULL,
NULL,
sizeof (GstBus),
0,
(GInstanceInitFunc) gst_bus_init,
NULL
};
bus_type = g_type_register_static (GST_TYPE_OBJECT, "GstBus", &bus_info, 0);
}
return bus_type;
}
G_DEFINE_TYPE (GstBus, gst_bus, GST_TYPE_OBJECT);
/* fixme: do something about this */
static void
@ -162,15 +137,10 @@ marshal_VOID__MINIOBJECT (GClosure * closure, GValue * return_value,
static void
gst_bus_class_init (GstBusClass * klass)
{
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) klass;
GObjectClass *gobject_class = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
if (!g_thread_supported ())
g_thread_init (NULL);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_bus_dispose);
/**
@ -227,9 +197,7 @@ gst_bus_init (GstBus * bus)
static void
gst_bus_dispose (GObject * object)
{
GstBus *bus;
bus = GST_BUS (object);
GstBus *bus = GST_BUS (object);
if (bus->queue) {
GstMessage *message;

View file

@ -523,43 +523,15 @@ gst_clock_id_unschedule (GstClockID id)
/**
* GstClock abstract base class implementation
*/
GType
gst_clock_get_type (void)
{
static GType clock_type = 0;
if (G_UNLIKELY (clock_type == 0)) {
static const GTypeInfo clock_info = {
sizeof (GstClockClass),
NULL,
NULL,
(GClassInitFunc) gst_clock_class_init,
NULL,
NULL,
sizeof (GstClock),
0,
(GInstanceInitFunc) gst_clock_init,
NULL
};
clock_type = g_type_register_static (GST_TYPE_OBJECT, "GstClock",
&clock_info, G_TYPE_FLAG_ABSTRACT);
}
return clock_type;
}
G_DEFINE_TYPE (GstClock, gst_clock, GST_TYPE_OBJECT);
static void
gst_clock_class_init (GstClockClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
if (!g_thread_supported ())
g_thread_init (NULL);
#ifndef GST_DISABLE_TRACE
_gst_clock_entry_trace =
gst_alloc_trace_register (GST_CLOCK_ENTRY_TRACE_NAME);