Results 1 to 6 of 6

Thread: The application failed to initialize properly ( 0xc0000005). Click on OK to terminate

  1. #1

    Default The application failed to initialize properly ( 0xc0000005). Click on OK to terminate

    Hi,
    I'm using moc to manually compile a set of classes with slots containing Q_OBJECT macro,
    I have added the resulting cpp files to my project, and compiled the project, it has solved a bunch of vtable errors i had before but now when i run the program I get The application failed to initialize properly (0xc0000005). Click on OK to terminate the application.

    Anybody know why this is?

    here is my code
    abstract class called resourcebox
    Qt Code:
    1. /*
    2.  * ResourceBox.hpp
    3.  *
    4.  * Created on: 12-Sep-2008
    5.  * Author: Terabyte
    6.  */
    7.  
    8. #ifndef RESOURCEBOX_HPP_
    9. #define RESOURCEBOX_HPP_
    10. #include <string>
    11. #include <iostream>
    12. #include <QObject>
    13.  
    14. using namespace std;
    15.  
    16. class ResourceBox : public QObject{
    17. Q_OBJECT
    18. public slots:
    19. virtual void execute()=0;
    20.  
    21. public:
    22. ResourceBox();
    23. virtual ~ResourceBox();
    24. virtual string value() = 0;
    25. };
    26.  
    27. #endif /* RESOURCEBOX_HPP_ */
    To copy to clipboard, switch view to plain text mode 

    and one of the concrete classes from resource box.
    Qt Code:
    1. /*
    2.  * SvgBox.hpp
    3.  *
    4.  * Created on: 12-Sep-2008
    5.  * Author: Terabyte
    6.  */
    7.  
    8. #ifndef SVGBOX_HPP_
    9. #define SVGBOX_HPP_
    10.  
    11. /*
    12. #include <xercesc/parsers/XercesDOMParser.hpp>
    13. #include <xercesc/dom/DOM.hpp>
    14. #include <xercesc/sax/HandlerBase.hpp>
    15. #include <xercesc/util/XMLString.hpp>
    16. #include <xercesc/util/PlatformUtils.hpp>
    17. */
    18. #include "XMLBox.hpp"
    19. #include "ResourceBox.hpp"
    20. using namespace xercesc_2_8;
    21. using namespace std;
    22.  
    23. class SvgBox: public ResourceBox {
    24. Q_OBJECT
    25. public slots:
    26. void execute();
    27. private:
    28. XMLBox* xmlBox;
    29. DOMNode* node;
    30. public:
    31. SvgBox(XMLBox *box,DOMNode *domNode);
    32. virtual ~SvgBox();
    33. string value();
    34. };
    35.  
    36. #endif /* SVGBOX_HPP_ */
    To copy to clipboard, switch view to plain text mode 

    and the treemodel which connects signals to slots :

    Qt Code:
    1. /*
    2.  * TreeModel.cpp
    3.  *
    4.  * Created on: 26-Jul-2008
    5.  * Author: Terabyte
    6.  */
    7. #include <QtGui>
    8. #include "TreeItem.hpp"
    9. #include "TreeModel.hpp"
    10. #include <iostream>
    11. #include <QAbstractItemView>
    12. using namespace std;
    13.  
    14.  
    15. TreeModel::TreeModel(QTreeView *gview,/*const QString &data,*/ QObject *parent) : QAbstractItemModel(parent)
    16. {
    17. this->view = gview;
    18. this->rootItem = NULL;
    19. }
    20.  
    21. TreeModel::~TreeModel() {
    22. // TODO Auto-generated destructor stub
    23. delete rootItem;
    24.  
    25. }
    26.  
    27. int TreeModel::columnCount(const QModelIndex &parent) const
    28. {
    29. if (parent.isValid())
    30. return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
    31. else
    32. return rootItem->columnCount();
    33. }
    34.  
    35. QVariant TreeModel::data(const QModelIndex &index, int role) const
    36. {
    37. if (!index.isValid())
    38. return QVariant();
    39.  
    40. if (role != Qt::DisplayRole)
    41. return QVariant();
    42.  
    43. TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
    44.  
    45. return item->data(index.column());
    46. }
    47.  
    48. Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
    49. {
    50. if (!index.isValid())
    51. return Qt::ItemIsEnabled;
    52.  
    53. return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
    54. }
    55.  
    56. QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
    57. int role) const
    58. {
    59. if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
    60. return rootItem->data(section);
    61.  
    62. return QVariant();
    63. }
    64.  
    65. QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent)
    66. const
    67. {
    68. TreeItem *parentItem;
    69.  
    70. if (!parent.isValid())
    71. parentItem = rootItem;
    72. else
    73. parentItem = static_cast<TreeItem*>(parent.internalPointer());
    74.  
    75. TreeItem *childItem = parentItem->child(row);
    76. if (childItem)
    77. return createIndex(row, column, childItem);
    78. else
    79. return QModelIndex();
    80. }
    81.  
    82. QModelIndex TreeModel::parent(const QModelIndex &index) const
    83. {
    84. if (!index.isValid())
    85. return QModelIndex();
    86.  
    87. TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
    88. TreeItem *parentItem = childItem->parent();
    89.  
    90. if (parentItem == rootItem)
    91. return QModelIndex();
    92.  
    93. return createIndex(parentItem->row(), 0, parentItem);
    94. }
    95.  
    96. int TreeModel::rowCount(const QModelIndex &parent) const
    97. {
    98. TreeItem *parentItem;
    99.  
    100. if (!parent.isValid())
    101. parentItem = rootItem;
    102. else
    103. parentItem = static_cast<TreeItem*>(parent.internalPointer());
    104.  
    105. return parentItem->childCount();
    106. }
    107.  
    108. void TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
    109. {
    110. }
    111.  
    112. void TreeModel::startTag(ResourceBox *resourcebox){
    113. //create item, passing resourcebox, calling resourcebox display.
    114. //add to parent stack
    115. char x;
    116.  
    117.  
    118.  
    119. if (rootItem == NULL) {
    120.  
    121. cout << "root added";
    122. cin >> x;
    123. TreeItem *item = new TreeItem(resourcebox);
    124. cin >> x;
    125. rootItem = item;
    126. cin >> x;
    127. parents.push_back(item);
    128. } else {
    129. cin >> x;
    130. cout << "non root added";
    131. cin >> x;
    132. TreeItem *item = new TreeItem(resourcebox,parents.last());
    133. cin >> x;
    134. parents.last()->appendChild(item);
    135. cin >> x;
    136. parents.push_back(item);
    137. }
    138. cin >> x;
    139. this->view->connect(this->view,SIGNAL(QTreeView::DoubleClicked()),resourcebox,SLOT(execute()));
    140. QObject::connect(this->view,
    141. SIGNAL(QTreeView::DoubleClicked()),
    142. resourcebox,SLOT(extecute())
    143. );
    144. cin >> x;
    145. cout << "success";
    146.  
    147.  
    148. }
    149.  
    150. void TreeModel::endTag(){
    151. parents.pop_back();
    152. }
    153. void TreeModel::debug(){
    154. cout << "Parents " << this->parents.size() << endl;
    155. for (int i = 0; i < this->parents.size(); i++){
    156. this->parents.at(i)->debug();
    157. }
    158. }
    To copy to clipboard, switch view to plain text mode 

    though there is only the connect function here and commenting it out doesnt fix it.

    I am totally stuck on this one, dont know where to begin, thanks for any help

  2. #2
    Join Date
    Jan 2008
    Posts
    56
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi

    Please provide more information.
    Which OS / compiler / additional DLLs?

    I experienced this, when I used Qwt debug DLL with a release executable, e.g.

    Regards,

    Rainer

  3. #3

    Default Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi

    Quote Originally Posted by RThaden View Post
    Please provide more information.
    Which OS / compiler / additional DLLs?

    I experienced this, when I used Qwt debug DLL with a release executable, e.g.

    Regards,

    Rainer
    XP
    Cygwin (G++)
    Eclipse latest
    No 'additional' dll's just the qt ones as added to the path variable

  4. #4
    Join Date
    Jan 2008
    Posts
    56
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi

    If you haven't already done that:
    When you enter
    "The application failed to initialize properly (0xc0000005)" cygwin qt
    in google, you find some issues related to cygwin and qt and this error

    Rainer

  5. #5

    Default Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi

    I had a same problem ("The application failed to initialize properly (0xc0000005)") but with mingw.
    Was my fault - forgetting to initialize the pointer with new before using it !

  6. #6

    Default Re: The application failed to initialize properly ( 0xc0000005). Click on OK to termi

    Quote Originally Posted by RThaden View Post
    If you haven't already done that:
    When you enter
    "The application failed to initialize properly (0xc0000005)" cygwin qt
    in google, you find some issues related to cygwin and qt and this error

    Rainer
    Hi, thanks for the reply, and yes I have checked that with no luck, or at least one of those results is mine on another forum, and hasn't received a response.
    The other one that seems close is
    http://lists.trolltech.com/qt-intere...ad00315-0.html
    The original post is compiling qt on cygwin, and just - as most conversations about cygwin - resulted in some prat asking 'why would you want to do that' rather than knuckling down and answering the question.

    Just for more information, If I remark out Q_OBJECT everything compiles and runs but I get the error along the lines of "something regarding slots/signals does not exist" which is fair, since it doesn't because the Q_OBJECT macro has been omitted. So pretty the error I get happens if I don't comment out Q_OBJECT.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.