mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +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);
|
||||
mBackgroundTexture = nullptr;
|
||||
|
||||
if (mIsPreview && gPreviewWidget) {
|
||||
lcCamera* Camera = gPreviewWidget->GetCamera();
|
||||
|
||||
if (Camera && !Camera->IsSimple() && mCameras.FindIndex(Camera) != -1)
|
||||
gPreviewWidget->SetCamera(Camera);
|
||||
}
|
||||
else if (gMainWindow)
|
||||
if (gMainWindow)
|
||||
{
|
||||
const lcArray<View*>* Views = gMainWindow->GetViewsForModel(this);
|
||||
|
||||
|
|
|
@ -716,6 +716,7 @@ void lcPartSelectionListView::PreviewSelection(int InfoIndex)
|
|||
|
||||
if (Preview && ViewWidget)
|
||||
{
|
||||
ViewWidget->setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
if (!Preview->SetCurrentPiece(Info->mFileName, ColorCode))
|
||||
QMessageBox::critical(gMainWindow, tr("Error"), tr("Preview %1 failed.").arg(Info->mFileName));
|
||||
ViewWidget->SetPreviewPosition(rect());
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include "lc_qglwidget.h"
|
||||
|
||||
lcPreviewWidget* gPreviewWidget;
|
||||
|
||||
lcPreviewDockWidget::lcPreviewDockWidget(QMainWindow* Parent)
|
||||
: QMainWindow(Parent)
|
||||
{
|
||||
|
@ -104,8 +102,6 @@ lcPreviewWidget::~lcPreviewWidget()
|
|||
delete mCamera;
|
||||
|
||||
delete mLoader;
|
||||
|
||||
gPreviewWidget = nullptr;
|
||||
}
|
||||
|
||||
bool lcPreviewWidget::SetCurrentPiece(const QString& PartType, int ColorCode)
|
||||
|
|
|
@ -149,5 +149,3 @@ protected:
|
|||
int mMouseDownX;
|
||||
int mMouseDownY;
|
||||
};
|
||||
|
||||
extern lcPreviewWidget* gPreviewWidget;
|
||||
|
|
Loading…
Reference in a new issue