Hello.
OK, here's the problem: I have this class:
#include <QMainWindow>
#include <QList>
#include <QModelIndex>
namespace Ui {
class StimulatorMainWindow;
}
class Backend;
class ChannelsTabWidget;
class ConfigurationDialog;
class CustomTreatmentDialog;
class PatternsListDelegate;
class TreatmentsModel;
class QStateMachine;
class QStyledItemDelegate;
{
Q_OBJECT
public:
explicit StimulatorMainWindow
(QWidget *parent
= 0);
~StimulatorMainWindow();
protected:
const QVariantHash ¤tIndexData();
private:
PatternsListDelegate *_patternsListDelegate;
QStyledItemDelegate *_regularItemDelegate;
CustomTreatmentDialog *_treatmentEditDialog, *_treatmentCreateDialog;
ConfigurationDialog *_configDiag;
QStateMachine *_interfaceMachine;
Backend *_backend;
TreatmentsModel *_patternsModel;
Ui::StimulatorMainWindow *_ui;
/* Methods and signals */
};
#include <QMainWindow>
#include <QList>
#include <QModelIndex>
namespace Ui {
class StimulatorMainWindow;
}
class Backend;
class ChannelsTabWidget;
class ConfigurationDialog;
class CustomTreatmentDialog;
class PatternsListDelegate;
class TreatmentsModel;
class QLabel;
class QMenu;
class QMessageBox;
class QModelIndex;
class QPushButton;
class QResizeEvent;
class QStateMachine;
class QStyledItemDelegate;
class StimulatorMainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit StimulatorMainWindow(QWidget *parent = 0);
~StimulatorMainWindow();
protected:
void closeEvent(QCloseEvent *);
const QVariantHash ¤tIndexData();
private:
PatternsListDelegate *_patternsListDelegate;
QStyledItemDelegate *_regularItemDelegate;
CustomTreatmentDialog *_treatmentEditDialog, *_treatmentCreateDialog;
QModelIndex _currentPatternIndex;
QMessageBox *_treatmentWarning;
ConfigurationDialog *_configDiag;
QMenu *_patternsMenu;
QAction *_newTreatmentSeparator;
QStateMachine *_interfaceMachine;
Backend *_backend;
TreatmentsModel *_patternsModel;
Ui::StimulatorMainWindow *_ui;
/* Methods and signals */
};
To copy to clipboard, switch view to plain text mode
But, if I try to declare a new variable inside it, say, an int, I will definitively get a segfault if I use that variable.
If I declare this variable before Ui::StimulatorMainWindow *_ui;, I'll get a segfault right after trying to run the application, even if I don't use the variable. Here are Valgrind (http://pastebin.com/uAa8yaYq) and backtrace (http://pastebin.com/1jQF8X4u) for this case.
But if I declare the new variable after Ui::StimulatorMainWindow *_ui; and then use it in the class definition (by, for example, attributing it some value), I'll get a segfault from the first tr() after its usage, but not from the ones before. Valgrind (http://pastebin.com/58DrJ3A9) and backtrace (http://pastebin.com/1jQF8X4u).
Anyway, this is related to the translate() method, but I have absolutely no idea how. It never happened before and, as I said, all I did was to declare a new variable and attribute it a value.
What's going on? What's wrong with my class?
I'm completely lost on this one, so any kind of help would be appreciated.
Thanks.
Bookmarks