Re: <gstmm.h> include errors



José Alburquerque wrote:
What I'm trying to do is run the debugger across all the code and see where I'm encountering the problem. I can see the gstreammermm code, but I can't see the glibmm, gstreamer and other library code because my distribution has separated the libraries (like glibmm, gtkmm, gstreamer) from the symbols (by stripping). They provide debugging packages with the symbols, but I can't figure out how to get gdb to show me the source code using the debugging packages.


Okay, by reading the gdb docs, I found out that I needed to have the source of the libraries that I want to debug so I installed the source of those libraries (glibmm, etc.). I now can debug fine and here's what I found: Gst::Element::create(), which looks like the following:

namespace Gst
{

Glib::RefPtr<Element>
Element::create(const Glib::ustring& factoryname, const Glib::ustring& name)
{
GstElement * element = gst_element_factory_make(factoryname.c_str(), name.c_str());
 return wrap(element, false);
}

succeeds when calling "gst_element_factory_make()" and element is a valid pointer, but fails when returning the value from Gst::wrap(GstElement*, bool takecopy) so I changed Gst::wrap(GstElement*,bool) from

namespace Gst
{

Glib::RefPtr<Gst::Element> wrap(GstElement* object, bool take_copy)
{
return Glib::RefPtr<Gst::Element>( dynamic_cast<Gst::Element*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
 //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Gst */

to:

namespace Gst
{

Glib::RefPtr<Gst::Element> wrap(GstElement* object, bool take_copy)
{
Glib::ObjectBase* objBase =Glib::wrap_auto ((GObject*)(object), take_copy);
 Gst::Element* e = dynamic_cast<Gst::Element*>(objBase);
 std::cout << typeid(*e).name() << std::endl;
Glib::RefPtr<Gst::Element> element = Glib::RefPtr<Gst::Element>( dynamic_cast<Gst::Element*>(e) );
 return element;
 //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Gst */

When I ran the code using the second definition of Gst::wrap(GstElement*,bool), the program crashes on the 3rd line (std::cout << ...) with the following error:

terminate called after throwing an instance of 'std::bad_typeid'
 what():  std::bad_typeid

-Jose


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]