examples/qmlsinnk-multisink: allow running with leaks tracer

Include a gst_deinit() after the qml engine has been destroyed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6160>
This commit is contained in:
Matthew Waters 2024-02-21 19:13:45 +11:00 committed by Tim-Philipp Müller
parent f1637a3601
commit 697b35fe58

View file

@ -9,12 +9,15 @@ main (int argc, char *argv[])
{ {
gst_init (&argc, &argv); gst_init (&argc, &argv);
int ret;
{
QGuiApplication app (argc, argv); QGuiApplication app (argc, argv);
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
/* make sure that plugin was loaded */ /* make sure that plugin was loaded */
GstElement *qmlglsink = gst_element_factory_make ("qmlglsink", NULL); GstElement *qmlglsink = gst_element_factory_make ("qmlglsink", NULL);
g_assert (qmlglsink); g_assert (qmlglsink);
gst_clear_object (&qmlglsink);
/* anything supported by videotestsrc */ /* anything supported by videotestsrc */
QStringList patterns ( QStringList patterns (
@ -25,11 +28,14 @@ main (int argc, char *argv[])
QVariant::fromValue (patterns)); QVariant::fromValue (patterns));
QObject::connect (&engine, &QQmlEngine::quit, [&] { QObject::connect (&engine, &QQmlEngine::quit, [&] {
gst_object_unref (qmlglsink);
qApp->quit (); qApp->quit ();
}); });
engine.load (QUrl (QStringLiteral ("qrc:///main.qml"))); engine.load (QUrl (QStringLiteral ("qrc:///main.qml")));
return app.exec (); ret = app.exec();
}
gst_deinit();
return ret;
} }