0

Since one week my Qt Application does not work. I was not familiar with this heap corruption, access violation etc. stuff. Now I know it "hurts" terribly,-)

Meanwhile I installed the application verifier. I'm using VS2010, Qt 4.8.4, qwt 6.0.0. Now I reduced the GUI class to its minimum and still got a access violation via application verifier. This is the GUI code:

#include "mygui.h"
#include <QtGui/QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MYGUI w;
    w.show();
    return a.exec();
}

mygui.h:

#ifndef PFEGUI_H
#define PFEGUI_H

#include <QtGui/QMainWindow>
#include "ui_mygui.h"

#include <myengine.hpp>

class MYGUI : public QMainWindow
{
    Q_OBJECT

public:
    MYGUI(QWidget *parent = 0, Qt::WFlags flags = 0);
    ~MYGUI();

    Ui::MYGUIClass ui;

private:
    boost::shared_ptr<MYengine> myEngine_; 
    boost::shared_ptr<QMenu> treeWidgetMenu_;
    boost::shared_ptr<QAction> treeWidgetMenuDeleteAction_;

};

mygui.cpp:

#include "mygui.h"

MYGUI::MYGUI(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags)
{
    ui.setupUi(this);
    myEngine_ = boost::shared_ptr<MYengine>(new MYengine());
}

MYGUI::~MYGUI() {}

and the large autogenerated ui_mygui.h (because of the character limitation I skipped some part in the middle):

/********************************************************************************
** Form generated from reading UI file 'mygui.ui'
**
** Created: Thu 11. Apr 22:55:21 2013
**      by: Qt User Interface Compiler version 4.8.4
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_MYGUI_H
#define UI_MYGUI_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QDateEdit>
#include <QtGui/QDoubleSpinBox>
#include <QtGui/QFormLayout>
#include <QtGui/QFrame>
#include <QtGui/QGridLayout>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLCDNumber>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QMainWindow>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QProgressBar>
#include <QtGui/QPushButton>
#include <QtGui/QRadioButton>
#include <QtGui/QScrollArea>
#include <QtGui/QSlider>
#include <QtGui/QSpacerItem>
#include <QtGui/QSpinBox>
#include <QtGui/QStackedWidget>
#include <QtGui/QStatusBar>
#include <QtGui/QTabWidget>
#include <QtGui/QTextBrowser>
#include <QtGui/QToolBar>
#include <QtGui/QTreeWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QWidget>
#include "qwt_plot.h"

QT_BEGIN_NAMESPACE

class Ui_MYGUIClass
{
public:
    QWidget *centralWidget;
    QTabWidget *tabWidgetMYGUI;
    QWidget *tab;
    QWidget *layoutWidget;
    QVBoxLayout *verticalLayout;
    QPushButton *pushButtonSzenarienBerechnen;
    QPushButton *pushButtonMYBerechnen;
    QWidget *layoutWidget1;
    QVBoxLayout *verticalLayout_2;
    QHBoxLayout *horizontalLayout_4;
    QProgressBar *progressBarMY;
    QLCDNumber *lcdNumberWatch;
    QScrollArea *scrollAreaOutput;
    QWidget *scrollAreaWidgetContents;
    QGridLayout *gridLayout_6;
    QTextBrowser *textBrowserOutput;
    QWidget *tab_2;
    QGroupBox *groupBox_2;
    QGridLayout *gridLayout_5;
    QGridLayout *gridLayout_4;
    QPushButton *pushButtonPortfolioPfeBerechnen;
    QTreeWidget *treeWidgetPortfolioSimPort;
    QGroupBox *groupBox_3;
    QGridLayout *gridLayout_2;
    QHBoxLayout *horizontalLayout_10;
    QLabel *label_4;
    QComboBox *comboBoxPortfolioCtpNumbers;
    QHBoxLayout *horizontalLayout_11;
    QPushButton *pushButtonPortfolioShowCtp;
    QPushButton *pushButtonPortfolioAddCtp;
    QPushButton *pushButtonPortfolioAddAll;
    QGroupBox *groupBox_5;
    QGridLayout *gridLayout_10;
    QStackedWidget *stackedWidgetPortfolioAddDeal;
    QWidget *pageVanillaSwap;
    QGridLayout *gridLayout_11;
    QHBoxLayout *horizontalLayout_5;
    QRadioButton *radioButtonPortfolioPayer;
    QRadioButton *radioButtonPortfolioReceiver;
    QHBoxLayout *horizontalLayout_9;
    QLabel *label_19;
    QSpacerItem *horizontalSpacer_2;
    QDoubleSpinBox *doubleSpinBoxPortfolioFixRate;
    QHBoxLayout *horizontalLayout_6;
    QLabel *label_8;
    QSpacerItem *horizontalSpacer;
    QComboBox *comboBoxPortfolioIndices;
    QFormLayout *formLayout;
    QLabel *label_15;
    QComboBox *comboBoxPortfolioFixFreq;
    QLabel *label_16;
    QComboBox *comboBoxPortfolioFloatFreq;
    QFormLayout *formLayout_2;
    QLabel *label_18;
    QComboBox *comboBoxPortfolioFixDC;
    QLabel *label_20;
    QComboBox *comboBoxPortfolioFloatDC;
    QSpacerItem *verticalSpacer;
    QWidget *pagefxproducts;
    QGridLayout *gridLayout_12;
    QSpacerItem *verticalSpacer_2;
    QHBoxLayout *horizontalLayout_16;
    QLabel *label_21;
    QDoubleSpinBox *doubleSpinBoxPortfolioFxSpot;
    QHBoxLayout *horizontalLayout_14;
    QLabel *label_13;
    QDoubleSpinBox *doubleSpinBoxPortfolioForwardRate;
    QHBoxLayout *horizontalLayout_13;
    QLabel *label_12;
    QComboBox *comboBoxPortfolioCurrencyPairs;
    QHBoxLayout *horizontalLayout_8;
    QLabel *label_11;
    QSpinBox *spinBoxPortfolioNominal2;
    QLabel *labelPortfolioCurrency2;
    QComboBox *comboBoxPortfolioBuySell;
    QHBoxLayout *horizontalLayout_7;
    QLabel *label_10;
    QSpacerItem *horizontalSpacer_3;
    QLineEdit *lineEditPortfolioDealMaturity;
    QSpacerItem *horizontalSpacer_6;
    QDateEdit *dateEditPortfolioEndDate;
    QHBoxLayout *horizontalLayout_12;
    QLabel *label_9;
    QSpacerItem *horizontalSpacer_5;
    QDateEdit *dateEditPortfolioStartDate;
    QHBoxLayout *horizontalLayout_2;
    QLabel *label_6;
    QComboBox *comboBoxPortfolioInstrumentNames;
    QHBoxLayout *horizontalLayout_3;
    QLabel *label_7;
    QSpinBox *spinBoxPortfolioNominal;
    QComboBox *comboBoxPortfolioCurrencies;
    QPushButton *pushButtonPortfolioAddDeal;
    QHBoxLayout *horizontalLayout;
    QLabel *label_14;
    QSpacerItem *horizontalSpacer_4;
    QComboBox *comboBoxPortfolioAddDealCtpNumbers;
    QFrame *line;
    QHBoxLayout *horizontalLayout_15;
    QLabel *label_17;
    QLineEdit *lineEditPortfolioNPV;
    QPushButton *pushButtonPortfolioCalculateNPV;
    QComboBox *comboBoxPortfolioCtpNumbers_2;
    QWidget *tab_3;
    QwtPlot *qwtPlot;
    QWidget *layoutWidget_2;
    QHBoxLayout *horizontalLayout_18;
    QLabel *label_23;
    QComboBox *comboBoxAnalysisContractNumbers;
    QWidget *layoutWidget_3;
    QHBoxLayout *horizontalLayout_19;
    QLabel *label_24;
    QComboBox *comboBoxAnalysisCompNumbers;
    QPushButton *pushButtonAnalysisPlotCtp;
    QPushButton *pushButtonAnalysisPlotContract;
    QPushButton *pushButtonAnalysisPlotComp;
    QWidget *layoutWidget2;
    QHBoxLayout *horizontalLayout_17;
    QLabel *label_22;
    QComboBox *comboBoxAnalysisCtpNumbers;
    QCheckBox *checkBoxAnalysisSimulationPaths;
    QCheckBox *checkBoxAnalysisStatisticCurves;
    QGroupBox *groupBox_11;
    QWidget *layoutWidget3;
    QHBoxLayout *horizontalLayout_39;
    QRadioButton *radioButtonAnalysisBarStyle;
    QRadioButton *radioButtonAnalysisTubeStyle;
    QGroupBox *groupBox_12;
    QWidget *layoutWidget4;
    QHBoxLayout *horizontalLayout_20;
    QLabel *label_25;
    QSpinBox *spinBoxAnalysisSimStep;
    QLabel *label_26;
    QDateEdit *dateEditAnalysisChoosenDate;
    QPushButton *pushButtonAnalysisShowMarketData;
    QWidget *tab_7;
    QwtPlot *qwtPlot_2;
    QGroupBox *groupBox_6;
    QSpinBox *spinBoxAnalysisSimStep_2;
    QPushButton *pushButton;
    QPushButton *pushButton_2;
    QPushButton *pushButton_3;
    QPushButton *pushButton_4;
    QWidget *OptionsTab;
    QGroupBox *groupBox;
    QWidget *layoutWidget5;
    QGridLayout *gridLayout;
    QLabel *label;
    QSpinBox *spinBoxSimSteps;
    QSlider *horizontalSliderSimSteps;
    QLabel *label_2;
    QSpinBox *spinBoxForwardSteps;
    QSlider *horizontalSliderSimSteps_2;
    QLabel *label_3;
    QDoubleSpinBox *spinBoxJumpProb;
    QGroupBox *groupBox_4;
    QLabel *label_5;
    QLineEdit *lineEditSettingsInstrumentFile;
    QPushButton *pushButtonSettingsInstFileBrowse;
    QTextBrowser *textBrowserPortfolioCtpTrades;
    QStackedWidget *stackedWidget_2;
    QWidget *page_3;
    QWidget *page_4;
    QMenuBar *menuBar;
    QMenu *menuOptions;
    QToolBar *mainToolBar;
    QStatusBar *statusBar;
    QButtonGroup *buttonGroup_2;

    void setupUi(QMainWindow *MYGUIClass)
    {
        if (MYGUIClass->objectName().isEmpty())
            MYGUIClass->setObjectName(QString::fromUtf8("MYGUIClass"));
        MYGUIClass->resize(1538, 777);
        centralWidget = new QWidget(MYGUIClass);
        centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
        tabWidgetMYGUI = new QTabWidget(centralWidget);
        tabWidgetMYGUI->setObjectName(QString::fromUtf8("tabWidgetMYGUI"));
        tabWidgetMYGUI->setGeometry(QRect(11, 0, 1521, 751));
        tabWidgetMYGUI->setIconSize(QSize(16, 16));
        tab = new QWidget();
        tab->setObjectName(QString::fromUtf8("tab"));
        layoutWidget = new QWidget(tab);
        layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
        layoutWidget->setGeometry(QRect(10, 50, 401, 62));
        verticalLayout = new QVBoxLayout(layoutWidget);
        verticalLayout->setSpacing(6);
        verticalLayout->setContentsMargins(11, 11, 11, 11);
        verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
        verticalLayout->setContentsMargins(0, 0, 0, 0);
        pushButtonSzenarienBerechnen = new QPushButton(layoutWidget);
        pushButtonSzenarienBerechnen->setObjectName(QString::fromUtf8("pushButtonSzenarienBerechnen"));
        pushButtonSzenarienBerechnen->setEnabled(true);
        QFont font;
        font.setPointSize(12);
        font.setBold(true);
        font.setWeight(75);
        pushButtonSzenarienBerechnen->setFont(font);
        pushButtonSzenarienBerechnen->setCheckable(false);

        verticalLayout->addWidget(pushButtonSzenarienBerechnen);

        pushButtonMYBerechnen = new QPushButton(layoutWidget);
        pushButtonMYBerechnen->setObjectName(QString::fromUtf8("pushButtonMYBerechnen"));
        pushButtonMYBerechnen->setEnabled(true);
        pushButtonMYBerechnen->setFont(font);
        pushButtonMYBerechnen->setCheckable(false);

        verticalLayout->addWidget(pushButtonMYBerechnen);


        verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);

        gridLayout_11->addItem(verticalSpacer, 4, 0, 1, 1);

        stackedWidgetPortfolioAddDeal->addWidget(pageVanillaSwap);
        pagefxproducts = new QWidget();
        pagefxproducts->setObjectName(QString::fromUtf8("pagefxproducts"));
        gridLayout_12 = new QGridLayout(pagefxproducts);
        gridLayout_12->setSpacing(6);
        gridLayout_12->setContentsMargins(11, 11, 11, 11);
        gridLayout_12->setObjectName(QString::fromUtf8("gridLayout_12"));
        verticalSpacer_2 = new QSpacerItem(20, 80, QSizePolicy::Minimum, QSizePolicy::Expanding);



// Tons of other autogenerated stuff are deleted here

        QTreeWidgetItem *___qtreewidgetitem = treeWidgetPortfolioSimPort->headerItem();
        ___qtreewidgetitem->setText(9, QApplication::translate("MYGUIClass", "MY Exposure", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(8, QApplication::translate("MYGUIClass", "MY Date", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(7, QApplication::translate("MYGUIClass", "MY", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(6, QApplication::translate("MYGUIClass", "Maturity", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(5, QApplication::translate("MYGUIClass", "int. NPV", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(4, QApplication::translate("MYGUIClass", "ext. NPV", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(3, QApplication::translate("MYGUIClass", "Comp Id", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(2, QApplication::translate("MYGUIClass", "Contract Id", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(1, QApplication::translate("MYGUIClass", "Ctp Id", 0, QApplication::UnicodeUTF8));
        ___qtreewidgetitem->setText(0, QApplication::translate("MYGUIClass", "Kategorie", 0, QApplication::UnicodeUTF8));
        groupBox_3->setTitle(QApplication::translate("MYGUIClass", "Add Counterparty", 0, QApplication::UnicodeUTF8));
        label_4->setText(QApplication::translate("MYGUIClass", "Counterparty number", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
        pushButtonPortfolioShowCtp->setToolTip(QApplication::translate("MYGUIClass", "<html><head/><body><p>Kundenportfolio anzeigen...</p></body></html>", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
        pushButtonPortfolioShowCtp->setText(QApplication::translate("MYGUIClass", "Show", 0, QApplication::UnicodeUTF8));
        pushButtonPortfolioAddCtp->setText(QApplication::translate("MYGUIClass", "Add", 0, QApplication::UnicodeUTF8));
        pushButtonPortfolioAddAll->setText(QApplication::translate("MYGUIClass", "Add all", 0, QApplication::UnicodeUTF8));
        groupBox_5->setTitle(QApplication::translate("MYGUIClass", "Add Deal", 0, QApplication::UnicodeUTF8));
        radioButtonPortfolioPayer->setText(QApplication::translate("MYGUIClass", "Payer", 0, QApplication::UnicodeUTF8));
        radioButtonPortfolioReceiver->setText(QApplication::translate("MYGUIClass", "Receiver", 0, QApplication::UnicodeUTF8));
        label_19->setText(QApplication::translate("MYGUIClass", "Fix Rate (in %)", 0, QApplication::UnicodeUTF8));
        label_8->setText(QApplication::translate("MYGUIClass", "Index", 0, QApplication::UnicodeUTF8));
        label_15->setText(QApplication::translate("MYGUIClass", "Fix Freq", 0, QApplication::UnicodeUTF8));
        label_16->setText(QApplication::translate("MYGUIClass", "Float Freq", 0, QApplication::UnicodeUTF8));
        label_18->setText(QApplication::translate("MYGUIClass", "Fix DC", 0, QApplication::UnicodeUTF8));
        label_20->setText(QApplication::translate("MYGUIClass", "Float DC", 0, QApplication::UnicodeUTF8));
        label_21->setText(QApplication::translate("MYGUIClass", "Spot", 0, QApplication::UnicodeUTF8));
        label_13->setText(QApplication::translate("MYGUIClass", "Forward rate", 0, QApplication::UnicodeUTF8));
        label_12->setText(QApplication::translate("MYGUIClass", "Currency pair", 0, QApplication::UnicodeUTF8));
        label_11->setText(QApplication::translate("MYGUIClass", "Notional 2", 0, QApplication::UnicodeUTF8));
        spinBoxPortfolioNominal2->setSuffix(QString());
        labelPortfolioCurrency2->setText(QApplication::translate("MYGUIClass", "USD", 0, QApplication::UnicodeUTF8));
        label_10->setText(QApplication::translate("MYGUIClass", "Maturity", 0, QApplication::UnicodeUTF8));
        lineEditPortfolioDealMaturity->setInputMask(QApplication::translate("MYGUIClass", "00y + 00m;_", 0, QApplication::UnicodeUTF8));
        lineEditPortfolioDealMaturity->setText(QApplication::translate("MYGUIClass", "05y + 00m", 0, QApplication::UnicodeUTF8));
        label_9->setText(QApplication::translate("MYGUIClass", "Start date", 0, QApplication::UnicodeUTF8));
        label_6->setText(QApplication::translate("MYGUIClass", "Inst-Type", 0, QApplication::UnicodeUTF8));
        label_7->setText(QApplication::translate("MYGUIClass", "Notional", 0, QApplication::UnicodeUTF8));
        spinBoxPortfolioNominal->setSuffix(QString());
        pushButtonPortfolioAddDeal->setText(QApplication::translate("MYGUIClass", "Add", 0, QApplication::UnicodeUTF8));
        label_14->setText(QApplication::translate("MYGUIClass", "Kunde", 0, QApplication::UnicodeUTF8));
        label_17->setText(QApplication::translate("MYGUIClass", "NPV", 0, QApplication::UnicodeUTF8));
        lineEditPortfolioNPV->setText(QApplication::translate("MYGUIClass", "not calculated", 0, QApplication::UnicodeUTF8));
        pushButtonPortfolioCalculateNPV->setText(QApplication::translate("MYGUIClass", "Calculate", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(tab_2), QApplication::translate("MYGUIClass", "Portfolio", 0, QApplication::UnicodeUTF8));
        label_23->setText(QApplication::translate("MYGUIClass", "Contract number", 0, QApplication::UnicodeUTF8));
        label_24->setText(QApplication::translate("MYGUIClass", "Component number", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisPlotCtp->setText(QApplication::translate("MYGUIClass", "Plot", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisPlotContract->setText(QApplication::translate("MYGUIClass", "Plot", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisPlotComp->setText(QApplication::translate("MYGUIClass", "Plot", 0, QApplication::UnicodeUTF8));
        label_22->setText(QApplication::translate("MYGUIClass", "Counterparty number", 0, QApplication::UnicodeUTF8));
        checkBoxAnalysisSimulationPaths->setText(QApplication::translate("MYGUIClass", "Show simulated NPV Paths", 0, QApplication::UnicodeUTF8));
        checkBoxAnalysisStatisticCurves->setText(QApplication::translate("MYGUIClass", "Show statistics", 0, QApplication::UnicodeUTF8));
        groupBox_11->setTitle(QApplication::translate("MYGUIClass", "Style Statistics", 0, QApplication::UnicodeUTF8));
        radioButtonAnalysisBarStyle->setText(QApplication::translate("MYGUIClass", "Bars", 0, QApplication::UnicodeUTF8));
        radioButtonAnalysisTubeStyle->setText(QApplication::translate("MYGUIClass", "Tube", 0, QApplication::UnicodeUTF8));
        groupBox_12->setTitle(QApplication::translate("MYGUIClass", "Simulation Parameters", 0, QApplication::UnicodeUTF8));
        label_25->setText(QApplication::translate("MYGUIClass", "Sim Step", 0, QApplication::UnicodeUTF8));
        label_26->setText(QApplication::translate("MYGUIClass", "Date", 0, QApplication::UnicodeUTF8));
        pushButtonAnalysisShowMarketData->setText(QApplication::translate("MYGUIClass", "Show Market Data", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(tab_3), QApplication::translate("MYGUIClass", "Analysis MY", 0, QApplication::UnicodeUTF8));
        groupBox_6->setTitle(QApplication::translate("MYGUIClass", "GroupBox", 0, QApplication::UnicodeUTF8));
        pushButton->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        pushButton_2->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        pushButton_3->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        pushButton_4->setText(QApplication::translate("MYGUIClass", "PushButton", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(tab_7), QApplication::translate("MYGUIClass", "Analysis MD", 0, QApplication::UnicodeUTF8));
        groupBox->setTitle(QApplication::translate("MYGUIClass", "Simulation parameters", 0, QApplication::UnicodeUTF8));
        label->setText(QApplication::translate("MYGUIClass", "Number of Simulation Steps", 0, QApplication::UnicodeUTF8));
        label_2->setText(QApplication::translate("MYGUIClass", "Number of Forward Steps", 0, QApplication::UnicodeUTF8));
        label_3->setText(QApplication::translate("MYGUIClass", "Jump Probability", 0, QApplication::UnicodeUTF8));
        groupBox_4->setTitle(QApplication::translate("MYGUIClass", "Input Files", 0, QApplication::UnicodeUTF8));
        label_5->setText(QApplication::translate("MYGUIClass", "Instrument File:", 0, QApplication::UnicodeUTF8));
        pushButtonSettingsInstFileBrowse->setText(QApplication::translate("MYGUIClass", "...", 0, QApplication::UnicodeUTF8));
        tabWidgetMYGUI->setTabText(tabWidgetMYGUI->indexOf(OptionsTab), QApplication::translate("MYGUIClass", "Settings", 0, QApplication::UnicodeUTF8));
        menuOptions->setTitle(QApplication::translate("MYGUIClass", "Options", 0, QApplication::UnicodeUTF8));
    } // retranslateUi

};

namespace Ui {
    class MYGUIClass: public Ui_MYGUIClass {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_MYGUI_H

This compiles without any problem. But when I start the application (using the aplication verifier) I get a triggered breakpoint after the method

void setupUi(QMainWindow *MYGUIClass)

in ui_mygui.h is finished and the constructor of MYengine is entered. No line of the constructor is executed it just triggers a breakpoint. This is the verifier report:

======================================= VERIFIER STOP 00000013: pid 0x1CDC: First chance access violation for current stack trace.

0AF79000 : Invalid address causing the exception.
00E15057 : Code address executing the invalid access.
0032F134 : Exception record.
0032F184 : Context record.

======================================= This verifier stop is continuable. After debugging it use `go' to continue.

=======================================

If I just delete the single line

myEngine_ = boost::shared_ptr<MYengine>(new MYengine());

in mygui.cpp the Gui opens, no application verifier breakpoint, everything seems to work fine.

I'm completly lost. class MYengine is a large class embedded in a static library with hundreds additional classes. The error occurs even before the first line of the constructor of Myengine is executed. So why is the behaviour so different with or without the above line? Any ideas would be highly appreciated. This code is starting to make me made,-(

Seba Stopol
  • 43
  • 1
  • 6
  • Why do you use boost::shared_ptr when there is QSharedPointer? – Archie Apr 11 '13 at 22:58
  • What level of optimization are you using? Memory corruption inside a MYEngine constructor could have led to an error in setupUi. – Ixanezis Apr 11 '13 at 23:01
  • @Archie: I tried it with QSharedPointer. No change. I'm new to Qt and always used boost shared pointer before. – Seba Stopol Apr 11 '13 at 23:51
  • @Ixanezis: I'm using maximum speed optimization. I was wrong with the exact line of the application verifier breakpoint. It is thrown just after the setupUi method, when the constructor of MYengine is entered. But before even the first line of the constructor is executed. – Seba Stopol Apr 11 '13 at 23:54
  • You probably did this but I'm gonna ask it anyway just to reduce the number of potential issues: Did you try a full rebuild? – Tim Meyer Apr 12 '13 at 07:01

1 Answers1

0

Without knowing the remainder of your code, I'm pretty sure that you should not put Qt Pointers into boost shared pointers - Qt has its own object lifecycle management and will delete memory without asking your shared pointer, so you might end up with a boost-pointer pointing to released memory. But this only applies to

boost::shared_ptr<QMenu> treeWidgetMenu_;
boost::shared_ptr<QAction> treeWidgetMenuDeleteAction_;

which should probably be QMenu* and QAction* respectively.

I assume, that MYengine is not a Qt class. Probably, you should show us the interface of MyEngine so that we can understand, why a shared pointer to MyEngine is causing trouble.

Jens
  • 6,173
  • 2
  • 24
  • 43