diff options
author | David Robillard <d@drobilla.net> | 2008-08-14 00:29:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-14 00:29:22 +0000 |
commit | efa03e862ad75e0a83fcf82a916720a82cdffc0b (patch) | |
tree | d2c0e6661576f2dd5cda62bc3b76864aac635429 /vstgui/vstgui.cpp | |
parent | 2f7d4f902639750d8c0ca49bb15ed11a3d5cadd9 (diff) | |
download | mda.lv2-efa03e862ad75e0a83fcf82a916720a82cdffc0b.tar.gz mda.lv2-efa03e862ad75e0a83fcf82a916720a82cdffc0b.tar.bz2 mda.lv2-efa03e862ad75e0a83fcf82a916720a82cdffc0b.zip |
Fix crash when showing control window for root patch.
git-svn-id: http://svn.drobilla.net/lad/mda-lv2@1362 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'vstgui/vstgui.cpp')
-rw-r--r-- | vstgui/vstgui.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/vstgui/vstgui.cpp b/vstgui/vstgui.cpp index 365c16b..2661738 100644 --- a/vstgui/vstgui.cpp +++ b/vstgui/vstgui.cpp @@ -978,13 +978,14 @@ void CDrawContext::forget () //----------------------------------------------------------------------------- long CDrawContext::getIndexColor (CColor color) { - XColor xcol; + /*XColor xcol; xcol.red = color.red << 8; xcol.green = color.green << 8; xcol.blue = color.blue << 8; xcol.flags = (DoRed | DoGreen | DoBlue); - XAllocColor (display, XDefaultColormap (display, 0), &xcol); - return xcol.pixel; + XAllocColor (display, getColormap(), &xcol); + return xcol.pixel;*/ + return (color.red << 16) + (color.green << 8) + color.blue; } //----------------------------------------------------------------------------- @@ -3450,6 +3451,10 @@ CBitmap::CBitmap (long ID) gNbCBitmap++; #endif + pHandle = 0; + pngRead = NULL; + pngInfo = NULL; + bool found = false; long i = 0; @@ -3462,6 +3467,7 @@ CBitmap::CBitmap (long ID) break; } } + ++i; } if (VSTGUI::bundlePath == NULL) { @@ -3551,10 +3557,8 @@ bool CBitmap::loadFromResource (long resourceID) //----------------------------------------------------------------------------- bool CBitmap::loadFromPath (const void* platformPath) { - if (pHandle != NULL) { + if (pHandle != NULL) dispose (); - closePng (); - } bool success = openPng ((char*)platformPath); if (success) @@ -3763,6 +3767,7 @@ bool CBitmap::openPng (const char* path) pngInfo = png_create_info_struct(pngRead); if (!pngInfo) { png_destroy_read_struct(&pngRead, NULL, NULL); + pngRead = NULL; return false; } @@ -3787,6 +3792,8 @@ bool CBitmap::closePng () png_destroy_read_struct(&pngRead, &pngInfo, NULL); fclose(pngFp); pngFp = NULL; + pngRead = NULL; + pngInfo = NULL; return true; } |