0

1 週間以来、Qt アプリケーションが機能しません。私はこのヒープの破損、アクセス違反などについてよく知りませんでした。今、私はそれがひどく「痛い」ことを知っています,-)

その間、アプリケーション検証ツールをインストールしました。私はVS2010、Qt 4.8.4、qwt 6.0.0を使用しています。ここで、GUI クラスを最小限に減らしましたが、アプリケーション検証ツールを介してアクセス違反が発生しました。これは GUI コードです。

#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() {}

および大きな自動生成された ui_mygui.h (文字制限のため、途中の一部をスキップしました):

/********************************************************************************
** 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

これは問題なくコンパイルされます。しかし、(アプリケーション検証ツールを使用して) アプリケーションを起動すると、メソッドの後にトリガーされたブレークポイントが表示されます

void setupUi(QMainWindow *MYGUIClass)

in ui_mygui.h が完成し、MYengine のコンストラクタが入ります。コンストラクターの行は実行されず、ブレークポイントをトリガーするだけです。これは検証レポートです。

===================================== VERIFIER STOP 00000013: pid 0x1CDC: ファースト チャンス アクセス違反現在のスタック トレース用。

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

====================================== この検証停止は継続可能です。デバッグ後、「go」を使用して続行します。

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

1行だけ削除すると

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

mygui.cpp で、Gui が開きます。アプリケーション検証ブレークポイントはありません。すべて正常に動作しているようです。

私は完全に迷っています。class MYengine は、数百の追加クラスを含む静的ライブラリに埋め込まれた大きなクラスです。Myengine のコンストラクターの最初の行が実行される前でも、エラーが発生します。では、上記の行がある場合とない場合で、なぜ動作が大きく異なるのでしょうか? どんなアイデアでも大歓迎です。このコードは私を作り始めています、-(

4

1 に答える 1