Fixed Minifig Wizard crashes related to buffer operations without a context.

This commit is contained in:
leo 2015-02-07 23:02:20 +00:00
parent 49a49125c2
commit a31963f1bd
4 changed files with 8 additions and 4 deletions

View file

@ -996,7 +996,6 @@ bool lcPiecesLibrary::LoadPiece(PieceInfo* Info)
Mesh->UpdateBuffers(); Mesh->UpdateBuffers();
Info->SetMesh(Mesh); Info->SetMesh(Mesh);
Info->AddRef();
if (mZipFiles[LC_ZIPFILE_OFFICIAL]) if (mZipFiles[LC_ZIPFILE_OFFICIAL])
mSaveCache = true; mSaveCache = true;

View file

@ -3454,6 +3454,8 @@ void lcModel::ShowMinifigDialog()
if (!gMainWindow->DoDialog(LC_DIALOG_MINIFIG, &Minifig)) if (!gMainWindow->DoDialog(LC_DIALOG_MINIFIG, &Minifig))
return; return;
gMainWindow->mPreviewWidget->MakeCurrent();
lcGroup* Group = AddGroup("Minifig #", NULL); lcGroup* Group = AddGroup("Minifig #", NULL);
lcArray<lcObject*> Pieces(LC_MFW_NUMITEMS); lcArray<lcObject*> Pieces(LC_MFW_NUMITEMS);

View file

@ -1055,6 +1055,8 @@ void MinifigWizard::ParseSettings(lcFile& Settings)
void MinifigWizard::OnDraw() void MinifigWizard::OnDraw()
{ {
mContext->SetDefaultState();
float Aspect = (float)mWidth/(float)mHeight; float Aspect = (float)mWidth/(float)mHeight;
mContext->SetViewport(0, 0, mWidth, mHeight); mContext->SetViewport(0, 0, mWidth, mHeight);
@ -1404,6 +1406,8 @@ int MinifigWizard::GetSelectionIndex(int Type) const
void MinifigWizard::SetSelectionIndex(int Type, int Index) void MinifigWizard::SetSelectionIndex(int Type, int Index)
{ {
MakeCurrent();
if (mMinifig->Parts[Type]) if (mMinifig->Parts[Type])
mMinifig->Parts[Type]->Release(); mMinifig->Parts[Type]->Release();

View file

@ -140,9 +140,9 @@ bool GL_ExtensionSupported(const GLubyte* Extensions, const char* Name)
#ifndef QT_NO_DEBUG #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 #endif
@ -162,7 +162,6 @@ void GL_InitializeSharedExtensions(lcGLWidget* Window)
glEnable(GL_DEBUG_OUTPUT); glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
} }
glBegin(-1);
} }
#endif #endif