Fixed invalid memory free.

This commit is contained in:
leo 2014-04-20 19:09:46 +00:00
parent 54beb09a97
commit 7e2180e132
3 changed files with 15 additions and 3 deletions

View file

@ -48,16 +48,27 @@ public:
mInputState.Shift = false;
mInputState.Alt = false;
mContext = new lcContext();
mDeleteContext = true;
}
virtual ~lcGLWidget()
{
delete mContext;
if (mDeleteContext)
delete mContext;
}
void* GetExtensionAddress(const char* FunctionName);
void ShowPopupMenu();
void SetContext(lcContext* Context)
{
if (mDeleteContext)
delete mContext;
mContext = Context;
mDeleteContext = false;
}
void MakeCurrent();
void Redraw();
void CaptureMouse();
@ -83,6 +94,7 @@ public:
int mCursorType;
void* mWidget;
lcContext* mContext;
bool mDeleteContext;
};
#endif // _LC_GLWIDGET_H_

View file

@ -3340,7 +3340,7 @@ void Project::CreateImages(Image* images, int width, int height, unsigned short
view.SetCamera(m_ActiveView->mCamera, false);
view.mWidth = width;
view.mHeight = height;
view.mContext = gMainWindow->mPreviewWidget->mContext;
view.SetContext(gMainWindow->mPreviewWidget->mContext);
if (!hilite)
SelectAndFocusNone(false);

View file

@ -807,7 +807,7 @@ void lcQMainWindow::print(QPrinter *printer)
view.SetCamera(project->GetActiveView()->mCamera, false);
view.mWidth = tileWidth;
view.mHeight = tileHeight;
view.mContext = piecePreview->widget->mContext;
view.SetContext(piecePreview->widget->mContext);
GL_BeginRenderToTexture(tileWidth, tileHeight);
glPixelStorei(GL_PACK_ALIGNMENT, 1);