mirror of
https://github.com/leozide/leocad
synced 2025-01-30 20:34:56 +01:00
Fixed crash on exit. Fixes #520.
This commit is contained in:
parent
5c5e2d8832
commit
6decd02761
4 changed files with 2 additions and 13 deletions
|
@ -266,13 +266,7 @@ void lcModel::DeleteModel()
|
||||||
lcReleaseTexture(mBackgroundTexture);
|
lcReleaseTexture(mBackgroundTexture);
|
||||||
mBackgroundTexture = nullptr;
|
mBackgroundTexture = nullptr;
|
||||||
|
|
||||||
if (mIsPreview && gPreviewWidget) {
|
if (gMainWindow)
|
||||||
lcCamera* Camera = gPreviewWidget->GetCamera();
|
|
||||||
|
|
||||||
if (Camera && !Camera->IsSimple() && mCameras.FindIndex(Camera) != -1)
|
|
||||||
gPreviewWidget->SetCamera(Camera);
|
|
||||||
}
|
|
||||||
else if (gMainWindow)
|
|
||||||
{
|
{
|
||||||
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
|
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
|
||||||
|
|
||||||
|
|
|
@ -716,6 +716,7 @@ void lcPartSelectionListView::PreviewSelection(int InfoIndex)
|
||||||
|
|
||||||
if (Preview && ViewWidget)
|
if (Preview && ViewWidget)
|
||||||
{
|
{
|
||||||
|
ViewWidget->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
if (!Preview->SetCurrentPiece(Info->mFileName, ColorCode))
|
if (!Preview->SetCurrentPiece(Info->mFileName, ColorCode))
|
||||||
QMessageBox::critical(gMainWindow, tr("Error"), tr("Preview %1 failed.").arg(Info->mFileName));
|
QMessageBox::critical(gMainWindow, tr("Error"), tr("Preview %1 failed.").arg(Info->mFileName));
|
||||||
ViewWidget->SetPreviewPosition(rect());
|
ViewWidget->SetPreviewPosition(rect());
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
#include "lc_qglwidget.h"
|
#include "lc_qglwidget.h"
|
||||||
|
|
||||||
lcPreviewWidget* gPreviewWidget;
|
|
||||||
|
|
||||||
lcPreviewDockWidget::lcPreviewDockWidget(QMainWindow* Parent)
|
lcPreviewDockWidget::lcPreviewDockWidget(QMainWindow* Parent)
|
||||||
: QMainWindow(Parent)
|
: QMainWindow(Parent)
|
||||||
{
|
{
|
||||||
|
@ -104,8 +102,6 @@ lcPreviewWidget::~lcPreviewWidget()
|
||||||
delete mCamera;
|
delete mCamera;
|
||||||
|
|
||||||
delete mLoader;
|
delete mLoader;
|
||||||
|
|
||||||
gPreviewWidget = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lcPreviewWidget::SetCurrentPiece(const QString& PartType, int ColorCode)
|
bool lcPreviewWidget::SetCurrentPiece(const QString& PartType, int ColorCode)
|
||||||
|
|
|
@ -149,5 +149,3 @@ protected:
|
||||||
int mMouseDownX;
|
int mMouseDownX;
|
||||||
int mMouseDownY;
|
int mMouseDownY;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern lcPreviewWidget* gPreviewWidget;
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue