Skip to content

Instantly share code, notes, and snippets.

@gaspard
Created March 25, 2012 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaspard/2192946 to your computer and use it in GitHub Desktop.
Save gaspard/2192946 to your computer and use it in GitHub Desktop.
Simple Qt module producing bug 24945
#include <QtGui/QApplication>
#include <QtCore/QTimer>
#include <qglobal.h>
#include <cstdio>
static int app_argc = 0;
static char *app_argv[] = {};
static void something() {
QString msg("test");
/*******************************************************
* This is the code that produces the crash, without *
* being called. Just the presence of 'toUtf8' makes *
* the dlclose crash with SIGSEGV. *
* *
* The problem only appears if an application is run. *
*******************************************************/
printf("%s\n", msg.toUtf8().data());
}
extern "C" {
void run_test(bool run_something) {
printf("[in mod] Qt lib version: %s.\n", QT_VERSION_STR);
if (run_something) {
something();
}
QApplication *app = new QApplication(app_argc, app_argv);
QTimer *timer = new QTimer(app);
QObject::connect(timer, SIGNAL(timeout()),
app, SLOT(quit()));
timer->start(200);
app->exec();
delete app;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment