[geloest]_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
Verfasst: 27. April 2007 19:12
Ich bekomme bei einem Programm nachdem ich es schleiße ein en Assertion Error:
...\Debug\MyLegoViewer.exe
File:dbgdel.cpp
Line:52
Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
Nach googlen hab ich herausgefunden dass dieser Fehler kommt wenn ich ein objekt 2 mal deleten will. allerdings find ich nix in meinem code:
Könnt ihr mir helfen? Es sicher wieder irgendein doofer fehler aber ich find nix....
Mfg Karldin
...\Debug\MyLegoViewer.exe
File:dbgdel.cpp
Line:52
Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
Nach googlen hab ich herausgefunden dass dieser Fehler kommt wenn ich ein objekt 2 mal deleten will. allerdings find ich nix in meinem code:
Code: Alles auswählen
//MyLegoViewer.h
#ifndef MYLEGOVIEWER_H
#define MYLEGOVIEWER_H
#include<QWidget>
#include<QLabel>
#include<QPixmap>
#include<QImage>
#include<QVBoxLayout>
#include<QGridLayout>
#include<QString>
#include<QPushButton>
class vector;
class MyLegoViewer: public QWidget
{
Q_OBJECT
public:
MyLegoViewer(QWidget* parent=0);
~MyLegoViewer();
private:
QLabel imageholder;
QImage image;
std::vector<QString> filenames;
int counter;
QPushButton back;
QPushButton forward;
QGridLayout gridLayout;
QVBoxLayout boxLayout;
public slots:
void sBack();
void sForward();
};
#endif
Code: Alles auswählen
//MyLegoViewer.cpp
#include"MyLegoViewer.h"
#include<vector>
MyLegoViewer::MyLegoViewer(QWidget* parent)
:QWidget(parent)
{
back.setText("<<");
forward.setText(">>");
filenames.push_back("lego.bmp");
filenames.push_back("lego2.bmp");
counter=0;
image.load(filenames[0]);
imageholder.setPixmap(QPixmap::fromImage(image));
connect(&forward,SIGNAL(clicked()),this,SLOT(sForward()));
connect(&back,SIGNAL(clicked()),this,SLOT(sBack()));
gridLayout.addWidget(&back,0,0);
gridLayout.addWidget(&forward,0,1);
boxLayout.addWidget(&imageholder);
boxLayout.addLayout(&gridLayout);
setLayout(&boxLayout);
}
MyLegoViewer::~MyLegoViewer()
{}
void MyLegoViewer::sForward()
{
if(counter+1==filenames.size()) return;
else
{
image.load(filenames[++counter]);
imageholder.setPixmap(QPixmap::fromImage(image));
}
}
void MyLegoViewer::sBack()
{
if((counter-1)==-1) return;
else
{
image.load(filenames[--counter]);
imageholder.setPixmap(QPixmap::fromImage(image));
}
}
Code: Alles auswählen
//main.cpp
#include <QApplication>
#include"MyLegoViewer.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyLegoViewer window;
window.show();
return app.exec();
}
Mfg Karldin