欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process

程序员文章站 2022-04-19 16:37:06
...

前言

Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly
当这个问题出现时,我当时一脸懵逼,网上也有相关整理,我看了几篇,得出结论是内存错误。删除了不该删除的,然后再去访问该内存。
在声明的时候 将其QRubberBand* rubberBand = Q_NULLPTR;就可以了。或者构造函数时将其先置空。

代码如下:

#ifndef DEMODOUBLEBUFFWIDGET_H
#define DEMODOUBLEBUFFWIDGET_H

#include <QWidget>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QRubberBand>
class DemoDoubleBuffWidget : public QWidget
{
    Q_OBJECT
public:
    explicit DemoDoubleBuffWidget(QWidget *parent = nullptr);

signals:

public slots:

protected:
    void mousePressEvent(QMouseEvent*);
    void mouseMoveEvent(QMouseEvent*);
    void mouseReleaseEvent(QMouseEvent*);
   // void paintEvent(QPaintEvent*);
private:
    QPoint m_startPoint;
    QRubberBand* rubberBand = Q_NULLPTR;
};

#endif // DEMODOUBLEBUFFWIDGET_H

#include "demodoublebuffwidget.h"
#include <QPainter>
#include <QDebug>
#include <QRect>
DemoDoubleBuffWidget::DemoDoubleBuffWidget(QWidget *parent)
    : QWidget(parent)
{
}

void DemoDoubleBuffWidget::mousePressEvent(QMouseEvent * event)
{
    m_startPoint = event->pos();
    if (!rubberBand)
        rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
    rubberBand->setGeometry(QRect(m_startPoint, QSize(10,10)));
    rubberBand->show();
}

void DemoDoubleBuffWidget::mouseMoveEvent(QMouseEvent *event)
{
    rubberBand->setGeometry(QRect(m_startPoint, event->pos()).normalized());
}

void DemoDoubleBuffWidget::mouseReleaseEvent(QMouseEvent *event)
{
    rubberBand->hide();
}

//void DemoDoubleBuffWidget::paintEvent(QPaintEvent *event)
//{
//    qDebug() << __FUNCTION__;
//}

博客一
博客二常见Qt错误