From a31963f1bd7955f815329b55a422929b33828466 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 7 Feb 2015 23:02:20 +0000 Subject: [PATCH] Fixed Minifig Wizard crashes related to buffer operations without a context. --- common/lc_library.cpp | 1 - common/lc_model.cpp | 2 ++ common/minifig.cpp | 4 ++++ common/opengl.cpp | 5 ++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/lc_library.cpp b/common/lc_library.cpp index 628d8f38..db2306bf 100644 --- a/common/lc_library.cpp +++ b/common/lc_library.cpp @@ -996,7 +996,6 @@ bool lcPiecesLibrary::LoadPiece(PieceInfo* Info) Mesh->UpdateBuffers(); Info->SetMesh(Mesh); - Info->AddRef(); if (mZipFiles[LC_ZIPFILE_OFFICIAL]) mSaveCache = true; diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 3f1b3cc6..d4c709a6 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -3454,6 +3454,8 @@ void lcModel::ShowMinifigDialog() if (!gMainWindow->DoDialog(LC_DIALOG_MINIFIG, &Minifig)) return; + gMainWindow->mPreviewWidget->MakeCurrent(); + lcGroup* Group = AddGroup("Minifig #", NULL); lcArray Pieces(LC_MFW_NUMITEMS); diff --git a/common/minifig.cpp b/common/minifig.cpp index 5e4d5888..e2678035 100644 --- a/common/minifig.cpp +++ b/common/minifig.cpp @@ -1055,6 +1055,8 @@ void MinifigWizard::ParseSettings(lcFile& Settings) void MinifigWizard::OnDraw() { + mContext->SetDefaultState(); + float Aspect = (float)mWidth/(float)mHeight; mContext->SetViewport(0, 0, mWidth, mHeight); @@ -1404,6 +1406,8 @@ int MinifigWizard::GetSelectionIndex(int Type) const void MinifigWizard::SetSelectionIndex(int Type, int Index) { + MakeCurrent(); + if (mMinifig->Parts[Type]) mMinifig->Parts[Type]->Release(); diff --git a/common/opengl.cpp b/common/opengl.cpp index b3890fe8..64e3d26c 100644 --- a/common/opengl.cpp +++ b/common/opengl.cpp @@ -140,9 +140,9 @@ bool GL_ExtensionSupported(const GLubyte* Extensions, const char* Name) #ifndef QT_NO_DEBUG -static void APIENTRY lcDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid *userParam) +static void APIENTRY lcDebugCallback(GLenum Source, GLenum Type, GLuint Id, GLenum Severity, GLsizei Length, const GLchar* Message, GLvoid* UserParam) { - qDebug() << message; + qDebug() << Message; } #endif @@ -162,7 +162,6 @@ void GL_InitializeSharedExtensions(lcGLWidget* Window) glEnable(GL_DEBUG_OUTPUT); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); } - glBegin(-1); } #endif