diff options
author | Mauricio Piacentini <mauricio.piacentini@collabora.co.uk> | 2010-12-08 09:04:35 -0200 |
---|---|---|
committer | Mauricio Piacentini <mauricio.piacentini@collabora.co.uk> | 2010-12-08 09:34:28 -0200 |
commit | 5a36eaf266192b85dd1da5caaa31cf7ba2529b18 (patch) | |
tree | c9b21b712db4465aea19b61cdbb7bb96392d0cfa | |
parent | 0a8d2c5443482f137ca22cda434f66ad68920d9d (diff) |
TODO item: guard gst_object_ref_sink() call
-rw-r--r-- | src/QGst/bin.cpp | 8 | ||||
-rw-r--r-- | src/QGst/bus.cpp | 4 | ||||
-rw-r--r-- | src/QGst/elementfactory.cpp | 8 | ||||
-rw-r--r-- | src/QGst/ghostpad.cpp | 8 | ||||
-rw-r--r-- | src/QGst/pad.cpp | 4 | ||||
-rw-r--r-- | src/QGst/parse.cpp | 8 | ||||
-rw-r--r-- | src/QGst/pipeline.cpp | 4 | ||||
-rw-r--r-- | src/QGst/urihandler.cpp | 4 |
8 files changed, 36 insertions, 12 deletions
diff --git a/src/QGst/bin.cpp b/src/QGst/bin.cpp index 81b80a4..df2b624 100644 --- a/src/QGst/bin.cpp +++ b/src/QGst/bin.cpp @@ -26,7 +26,9 @@ namespace QGst { BinPtr Bin::create(const char *name) { GstElement *bin = gst_bin_new(name); - gst_object_ref_sink(bin); + if (bin) { + gst_object_ref_sink(bin); + } return BinPtr::wrap(GST_BIN(bin), false); } @@ -39,7 +41,9 @@ BinPtr Bin::fromDescription(const char *description, bool ghostUnlinkedPads) if (error) { throw QGlib::Error(error); } - gst_object_ref_sink(e); + if (e) { + gst_object_ref_sink(e); + } return BinPtr::wrap(GST_BIN(e), false); } diff --git a/src/QGst/bus.cpp b/src/QGst/bus.cpp index 5539f64..5a853ed 100644 --- a/src/QGst/bus.cpp +++ b/src/QGst/bus.cpp @@ -111,7 +111,9 @@ Q_GLOBAL_STATIC(Private::BusWatchManager, s_watchManager) BusPtr Bus::create() { GstBus *bus = gst_bus_new(); - gst_object_ref_sink(bus); + if (bus) { + gst_object_ref_sink(bus); + } return BusPtr::wrap(bus, false); } diff --git a/src/QGst/elementfactory.cpp b/src/QGst/elementfactory.cpp index 61ad8a8..153503e 100644 --- a/src/QGst/elementfactory.cpp +++ b/src/QGst/elementfactory.cpp @@ -32,7 +32,9 @@ ElementFactoryPtr ElementFactory::find(const char *factoryName) ElementPtr ElementFactory::make(const char *factoryName, const char *elementName) { GstElement *e = gst_element_factory_make(factoryName, elementName); - gst_object_ref_sink(e); + if (e) { + gst_object_ref_sink(e); + } return ElementPtr::wrap(e, false); } @@ -89,7 +91,9 @@ bool ElementFactory::canSrcCaps(const CapsPtr & caps) const ElementPtr ElementFactory::create(const char *elementName) const { GstElement *e = gst_element_factory_create(object<GstElementFactory>(), elementName); - gst_object_ref_sink(e); + if (e) { + gst_object_ref_sink(e); + } return ElementPtr::wrap(e, false); } diff --git a/src/QGst/ghostpad.cpp b/src/QGst/ghostpad.cpp index 2ad955a..501a4e4 100644 --- a/src/QGst/ghostpad.cpp +++ b/src/QGst/ghostpad.cpp @@ -22,14 +22,18 @@ namespace QGst { GhostPadPtr GhostPad::create(const PadPtr & target, const char *name) { GstPad *gp = gst_ghost_pad_new(name, target); - gst_object_ref_sink(gp); + if (gp) { + gst_object_ref_sink(gp); + } return GhostPadPtr::wrap(GST_GHOST_PAD(gp), false); } GhostPadPtr GhostPad::create(PadDirection direction, const char *name) { GstPad *gp = gst_ghost_pad_new_no_target(name, static_cast<GstPadDirection>(direction)); - gst_object_ref_sink(gp); + if (gp) { + gst_object_ref_sink(gp); + } return GhostPadPtr::wrap(GST_GHOST_PAD(gp), false); } diff --git a/src/QGst/pad.cpp b/src/QGst/pad.cpp index d0b80f1..7662b2a 100644 --- a/src/QGst/pad.cpp +++ b/src/QGst/pad.cpp @@ -29,7 +29,9 @@ namespace QGst { PadPtr Pad::create(PadDirection direction, const char *name) { GstPad *pad = gst_pad_new(name, static_cast<GstPadDirection>(direction)); - gst_object_ref_sink(pad); + if (pad) { + gst_object_ref_sink(pad); + } return PadPtr::wrap(pad, false); } diff --git a/src/QGst/parse.cpp b/src/QGst/parse.cpp index 388609d..1af4690 100644 --- a/src/QGst/parse.cpp +++ b/src/QGst/parse.cpp @@ -29,7 +29,9 @@ ElementPtr launch(const char* description) if (error) { throw QGlib::Error(error); } - gst_object_ref_sink(e); + if (e) { + gst_object_ref_sink(e); + } return ElementPtr::wrap(e, false); } @@ -40,7 +42,9 @@ ElementPtr launch(const char *argv[]) if (error) { throw QGlib::Error(error); } - gst_object_ref_sink(e); + if (e) { + gst_object_ref_sink(e); + } return ElementPtr::wrap(e, false); } diff --git a/src/QGst/pipeline.cpp b/src/QGst/pipeline.cpp index 69666d8..439479e 100644 --- a/src/QGst/pipeline.cpp +++ b/src/QGst/pipeline.cpp @@ -25,7 +25,9 @@ namespace QGst { PipelinePtr Pipeline::create(const char *name) { GstElement *p = gst_pipeline_new(name); - gst_object_ref_sink(p); + if (p) { + gst_object_ref_sink(p); + } return PipelinePtr::wrap(GST_PIPELINE(p), false); } diff --git a/src/QGst/urihandler.cpp b/src/QGst/urihandler.cpp index f0bdb9e..9a368d9 100644 --- a/src/QGst/urihandler.cpp +++ b/src/QGst/urihandler.cpp @@ -31,7 +31,9 @@ bool UriHandler::protocolIsSupported(UriType type, const char *protocol) UriHandlerPtr UriHandler::makeFromUri(UriType type, const QUrl & uri, const char *elementName) { GstElement *e = gst_element_make_from_uri(static_cast<GstURIType>(type), uri.toEncoded(), elementName); - gst_object_ref_sink(e); + if (e) { + gst_object_ref_sink(e); + } return UriHandlerPtr::wrap(GST_URI_HANDLER(e), false); } |