Skip to content

Instantly share code, notes, and snippets.

@tomalexander
Created March 20, 2015 23:37
Show Gist options
  • Save tomalexander/34d0f04a5a67a8e3a27c to your computer and use it in GitHub Desktop.
Save tomalexander/34d0f04a5a67a8e3a27c to your computer and use it in GitHub Desktop.
Minimum for segfault on linux
#include <QtWidgets/QApplication>
#include "main_window.h"
#include <string>
#include <iostream>
int main(int argc, char **argv)
{
QApplication app (argc, argv);
main_window window;
window.setWindowFlags(Qt::Window); // spawn its own window
window.show();
try {
return app.exec();
} catch(const std::string & e) {
std::cerr << "EXCEPTION: " << e << "\n";
return 1;
}
}
#include "main_window.h"
#include <QCamera>
#include <QWebView>
main_window::main_window(QWidget* parent):
QWidget(parent)
{
QWebView* view = new QWebView(this);
QCamera* camera = new QCamera(this);
}
main_window::~main_window()
{
}
#pragma once
#include <QtWidgets/QWidget>
#include <string>
class main_window : public QWidget
{
Q_OBJECT
public:
explicit main_window(QWidget* parent = nullptr);
virtual ~main_window();
private:
signals:
public slots:
};
TEMPLATE = app
TARGET = segfault
CONFIG += c++14
CONFIG += console
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
QT += multimedia multimediawidgets core gui widgets network webkit webkitwidgets
macx {
LIBS += -liconv
}
HEADERS = \
src/main_window.h \
SOURCES = \
src/main.cpp \
src/main_window.cpp \
@tomalexander
Copy link
Author

Segfault:

$ ./segfault 

(segfault:5998): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(segfault:5998): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(segfault:5998): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(segfault:5998): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(segfault:5998): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(segfault:5998): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(segfault:5998): GStreamer-CRITICAL **: gst_object_ref_sink: assertion 'object != NULL' failed

(segfault:5998): GStreamer-CRITICAL **: gst_element_get_bus: assertion 'GST_IS_ELEMENT (element)' failed

(segfault:5998): GStreamer-CRITICAL **: gst_bus_add_watch_full: assertion 'GST_IS_BUS (bus)' failed

(segfault:5998): GStreamer-CRITICAL **: gst_bus_set_sync_handler: assertion 'GST_IS_BUS (bus)' failed

(segfault:5998): GStreamer-CRITICAL **: gst_object_ref: assertion 'object != NULL' failed
Segmentation fault (core dumped)

backtrace:

(gdb) backtrace
#0  0x00007fffdbc15bbc in gst_caps_unref () from /usr/lib/libgstreamer-0.10.so.0
#1  0x00007fffdc52faed in QGstCodecsInfo::QGstCodecsInfo(QGstCodecsInfo::ElementType) () from /usr/lib/libqgsttools_p.so.1
#2  0x00007fffdc55b742 in ?? () from /usr/lib/qt/plugins/mediaservice/libgstcamerabin.so
#3  0x00007fffdc5549dd in ?? () from /usr/lib/qt/plugins/mediaservice/libgstcamerabin.so
#4  0x00007fffdc553f1f in ?? () from /usr/lib/qt/plugins/mediaservice/libgstcamerabin.so
#5  0x00007fffdc553580 in ?? () from /usr/lib/qt/plugins/mediaservice/libgstcamerabin.so
#6  0x00007ffff7f2ecd6 in ?? () from /usr/lib/libQt5Multimedia.so.5
#7  0x00007ffff7f52240 in QCamera::QCamera(QObject*) () from /usr/lib/libQt5Multimedia.so.5
#8  0x0000000000402bf6 in main_window::main_window(QWidget*) ()
#9  0x00000000004029d5 in main ()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment