Hello.

OK, here's the problem: I have this class:

Qt Code:
  1. #include <QMainWindow>
  2.  
  3. #include <QList>
  4. #include <QModelIndex>
  5.  
  6. namespace Ui {
  7. class StimulatorMainWindow;
  8. }
  9. class Backend;
  10. class ChannelsTabWidget;
  11. class ConfigurationDialog;
  12. class CustomTreatmentDialog;
  13. class PatternsListDelegate;
  14. class TreatmentsModel;
  15.  
  16. class QLabel;
  17. class QMenu;
  18. class QStateMachine;
  19. class QStyledItemDelegate;
  20.  
  21. class StimulatorMainWindow : public QMainWindow
  22. {
  23. Q_OBJECT
  24.  
  25. public:
  26. explicit StimulatorMainWindow(QWidget *parent = 0);
  27. ~StimulatorMainWindow();
  28.  
  29. protected:
  30. void closeEvent(QCloseEvent *);
  31.  
  32. const QVariantHash &currentIndexData();
  33.  
  34. private:
  35. PatternsListDelegate *_patternsListDelegate;
  36. QStyledItemDelegate *_regularItemDelegate;
  37. CustomTreatmentDialog *_treatmentEditDialog, *_treatmentCreateDialog;
  38. QModelIndex _currentPatternIndex;
  39. QMessageBox *_treatmentWarning;
  40. ConfigurationDialog *_configDiag;
  41. QMenu *_patternsMenu;
  42. QAction *_newTreatmentSeparator;
  43.  
  44. QStateMachine *_interfaceMachine;
  45.  
  46. Backend *_backend;
  47. TreatmentsModel *_patternsModel;
  48.  
  49. Ui::StimulatorMainWindow *_ui;
  50.  
  51. /* Methods and signals */
  52. };
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.