diff options
Diffstat (limited to 'indra')
39 files changed, 423 insertions, 204 deletions
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index 44c2d3ac27..f98e88b697 100755 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -64,6 +64,7 @@ if(WINDOWS) endif(USE_TCMALLOC) if (FMODEX) + set(debug_files ${debug_files} fmodexL.dll) set(release_files ${release_files} fmodex.dll) endif (FMODEX) @@ -294,7 +295,8 @@ elseif(LINUX) endif (USE_TCMALLOC) if (FMODEX) - set(release_file ${release_files} "libfmodex.so") + set(debug_files ${debug_files} "libfmodexL.so") + set(release_files ${release_files} "libfmodex.so") endif (FMODEX) else(WINDOWS) diff --git a/indra/cmake/FMODEX.cmake b/indra/cmake/FMODEX.cmake index 65bc1cabeb..163260137b 100644 --- a/indra/cmake/FMODEX.cmake +++ b/indra/cmake/FMODEX.cmake @@ -39,7 +39,7 @@ if (FMODEX) optimized fmodex) endif (WINDOWS) set(FMODEX_LIBRARIES ${FMODEX_LIBRARY}) - set(FMODEX_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/fmodex) + set(FMODEX_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/) endif (FMODEX_LIBRARY AND FMODEX_INCLUDE_DIR) endif (STANDALONE) endif (FMODEX) diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 63d01999f0..4cf82a3740 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -1973,7 +1973,10 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, } else { - llassert(gTextureManagerBridgep); + if (!gTextureManagerBridgep) + { + return LLPointer<LLGLTexture>(); + } tex = gTextureManagerBridgep->getLocalTexture( FALSE ); LLPointer<LLImageRaw> image_raw = new LLImageRaw; if( loadImageRaw( file_name, image_raw ) ) diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index d86a460511..61cd995cea 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -420,6 +420,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, return LLWearable::FAILURE; } LLUUID id = LLUUID(uuid_buffer); + + if (!gTextureManagerBridgep) + { + continue; + } + LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id ); if( mTEMap.find(te) != mTEMap.end() ) { @@ -592,7 +598,10 @@ void LLWearable::syncImages(te_map_t &src, te_map_t &dst) { // there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map. image_id = getDefaultTextureImageID((ETextureIndex) te); - image = gTextureManagerBridgep->getFetchedTexture( image_id ); + if (gTextureManagerBridgep) + { + image = gTextureManagerBridgep->getFetchedTexture( image_id ); + } } if( dst.find(te) != dst.end() ) diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index 8c31f8b4de..ef63b2cc04 100755 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -570,9 +570,14 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) // We had an error when decoding, abort. LL_WARNS("AudioEngine") << mCurrentDecodep->getUUID() << " has invalid vorbis data, aborting decode" << LL_ENDL; mCurrentDecodep->flushBadFile(); - LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID()); - adp->setHasValidData(false); - adp->setHasCompletedDecode(true); + + if (gAudiop) + { + LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID()); + adp->setHasValidData(false); + adp->setHasCompletedDecode(true); + } + mCurrentDecodep = NULL; done = TRUE; } @@ -584,7 +589,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) } else if (mCurrentDecodep) { - if (mCurrentDecodep->finishDecode()) + if (gAudiop && mCurrentDecodep->finishDecode()) { // We finished! LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID()); @@ -625,7 +630,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) { LLUUID uuid; mDecodeQueue.pop(uuid); - if (gAudiop->hasDecodedFile(uuid)) + if (!gAudiop || gAudiop->hasDecodedFile(uuid)) { // This file has already been decoded, don't decode it again. continue; @@ -671,7 +676,7 @@ void LLAudioDecodeMgr::processQueue(const F32 num_secs) BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) { - if (gAudiop->hasDecodedFile(uuid)) + if (gAudiop && gAudiop->hasDecodedFile(uuid)) { // Already have a decoded version, don't need to decode it. LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has decoded file already" << LL_ENDL; diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index ca614f5395..ecdfcaf73a 100755 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -674,8 +674,8 @@ void LLAudioEngine::cleanupBuffer(LLAudioBuffer *bufferp) bool LLAudioEngine::preloadSound(const LLUUID &uuid) { LL_DEBUGS("AudioEngine")<<"( "<<uuid<<" )"<<LL_ENDL; - - gAudiop->getAudioData(uuid); // We don't care about the return value, this is just to make sure + + getAudioData(uuid); // We don't care about the return value, this is just to make sure // that we have an entry, which will mean that the audio engine knows about this if (gAudioDecodeMgrp->addDecodeRequest(uuid)) @@ -828,7 +828,7 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i source_id.generate(); LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type); - gAudiop->addAudioSource(asp); + addAudioSource(asp); if (pos_global.isExactlyZero()) { asp->setAmbient(true); @@ -1211,8 +1211,8 @@ void LLAudioEngine::startNextTransfer() if (asset_id.notNull()) { LL_INFOS("AudioEngine") << "Getting audio asset data for: " << asset_id << LL_ENDL; - gAudiop->mCurrentTransfer = asset_id; - gAudiop->mCurrentTransferTimer.reset(); + mCurrentTransfer = asset_id; + mCurrentTransferTimer.reset(); gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND, assetCallback, NULL); } @@ -1226,6 +1226,12 @@ void LLAudioEngine::startNextTransfer() // static void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 result_code, LLExtStat ext_status) { + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return; + } + if (result_code) { LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL; @@ -1350,7 +1356,12 @@ void LLAudioSource::updatePriority() // Priority is based on distance LLVector3 dist_vec; dist_vec.setVec(getPositionGlobal()); - dist_vec -= gAudiop->getListenerPos(); + + if (gAudiop) + { + dist_vec -= gAudiop->getListenerPos(); + } + F32 dist_squared = llmax(1.f, dist_vec.magVecSquared()); mPriority = mGain / dist_squared; @@ -1367,6 +1378,11 @@ bool LLAudioSource::setupChannel() return false; } + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return false; + } if (!mChannelp) { @@ -1410,6 +1426,12 @@ bool LLAudioSource::play(const LLUUID &audio_uuid) // Reset our age timeout if someone attempts to play the source. mAgeTimer.reset(); + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return false; + } + LLAudioData *adp = gAudiop->getAudioData(audio_uuid); addAudioData(adp); @@ -1517,6 +1539,13 @@ void LLAudioSource::addAudioData(LLAudioData *adp, const bool set_current) { // Only handle a single piece of audio data associated with a source right now, // until I implement prefetch. + + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return; + } + if (set_current) { if (!mCurrentDatap) @@ -1685,6 +1714,12 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep) bool LLAudioChannel::updateBuffer() { + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return false; + } + if (!mCurrentSourcep) { // This channel isn't associated with any source, nothing @@ -1693,10 +1728,7 @@ bool LLAudioChannel::updateBuffer() } // Initialize the channel's gain setting for this sound. - if(gAudiop) - { - setSecondaryGain(gAudiop->getSecondaryGain(mCurrentSourcep->getType())); - } + setSecondaryGain(gAudiop->getSecondaryGain(mCurrentSourcep->getType())); LLAudioBuffer *bufferp = mCurrentSourcep->getCurrentBuffer(); if (bufferp == mCurrentBufferp) @@ -1753,8 +1785,14 @@ LLAudioData::LLAudioData(const LLUUID &uuid) : // This is a null sound. return; } + + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return; + } - if (gAudiop && gAudiop->hasDecodedFile(uuid)) + if (gAudiop->hasDecodedFile(uuid)) { // Already have a decoded version, don't need to decode it. setHasLocalData(true); @@ -1777,6 +1815,12 @@ bool LLAudioData::load() LL_INFOS("AudioEngine") << "Already have a buffer for this sound, don't bother loading!" << LL_ENDL; return true; } + + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return false; + } mBufferp = gAudiop->getFreeBuffer(); if (!mBufferp) diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index e9b74b8f41..36e8044a25 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -5,7 +5,7 @@ * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2014, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -55,11 +55,13 @@ LLAudioEngine_FMODEX::LLAudioEngine_FMODEX(bool enable_profiler) mWindDSP = NULL; mSystem = NULL; mEnableProfiler = enable_profiler; + mWindDSPDesc = new FMOD_DSP_DESCRIPTION(); } LLAudioEngine_FMODEX::~LLAudioEngine_FMODEX() { + delete mWindDSPDesc; } @@ -320,8 +322,8 @@ void LLAudioEngine_FMODEX::shutdown() llinfos << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << llendl; if ( mSystem ) // speculative fix for MAINT-2657 { - mSystem->close(); - mSystem->release(); + mSystem->close(); + mSystem->release(); } llinfos << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << llendl; @@ -347,15 +349,14 @@ bool LLAudioEngine_FMODEX::initWind() if (!mWindDSP) { - FMOD_DSP_DESCRIPTION dspdesc; - memset(&dspdesc, 0, sizeof(FMOD_DSP_DESCRIPTION)); //Set everything to zero - strncpy(dspdesc.name,"Wind Unit", sizeof(dspdesc.name)); //Set name to "Wind Unit" - dspdesc.channels=2; - dspdesc.read = &windCallback; //Assign callback. - if(Check_FMOD_Error(mSystem->createDSP(&dspdesc, &mWindDSP), "FMOD::createDSP")) + memset(mWindDSPDesc, 0, sizeof(*mWindDSPDesc)); //Set everything to zero + strncpy(mWindDSPDesc->name, "Wind Unit", sizeof(mWindDSPDesc->name)); + mWindDSPDesc->channels = 2; + mWindDSPDesc->read = &windCallback; // Assign callback - may be called from arbitrary threads + if (Check_FMOD_Error(mSystem->createDSP(mWindDSPDesc, &mWindDSP), "FMOD::createDSP")) return false; - if(mWindGen) + if (mWindGen) delete mWindGen; float frequency = 44100; @@ -364,6 +365,7 @@ bool LLAudioEngine_FMODEX::initWind() mWindDSP->setUserData((void*)mWindGen); } + // *TODO: Should this guard against multiple plays? if (mWindDSP) { mSystem->playDSP(FMOD_CHANNEL_FREE, mWindDSP, false, 0); @@ -741,6 +743,9 @@ void LLAudioChannelFMODEX::set3DMode(bool use3d) } } +// *NOTE: This is almost certainly being called on the mixer thread, +// not the main thread. May have implications for callees or audio +// engine shutdown. FMOD_RESULT F_CALLBACK windCallback(FMOD_DSP_STATE *dsp_state, float *originalbuffer, float *newbuffer, unsigned int length, int inchannels, int outchannels) { diff --git a/indra/llaudio/llaudioengine_fmodex.h b/indra/llaudio/llaudioengine_fmodex.h index 415a9ed0ef..ca389d489f 100644 --- a/indra/llaudio/llaudioengine_fmodex.h +++ b/indra/llaudio/llaudioengine_fmodex.h @@ -5,7 +5,7 @@ * * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2014, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -41,6 +41,7 @@ namespace FMOD class Sound; class DSP; } +typedef struct FMOD_DSP_DESCRIPTION FMOD_DSP_DESCRIPTION; //Interfaces class LLAudioEngine_FMODEX : public LLAudioEngine @@ -74,6 +75,7 @@ protected: LLWindGen<MIXBUFFERFORMAT> *mWindGen; + FMOD_DSP_DESCRIPTION *mWindDSPDesc; FMOD::DSP *mWindDSP; FMOD::System *mSystem; bool mEnableProfiler; diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index c8a05e1fae..55609deb2b 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -230,7 +230,7 @@ const U8* LLImageBase::getData() const { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + llwarns << "Bad memory allocation for the image buffer!" << llendl ; } return mData; @@ -240,7 +240,7 @@ U8* LLImageBase::getData() { if(mBadBufferAllocation) { - llerrs << "Bad memory allocation for the image buffer!" << llendl ; + llwarns << "Bad memory allocation for the image buffer!" << llendl ; } return mData; @@ -293,7 +293,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_c { setDataAndSize(data, width, height, components); } - else if(allocateDataSize(width, height, components)) + else if(allocateDataSize(width, height, components) && getData()) { memcpy(getData(), data, width*height*components); } @@ -431,6 +431,11 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) // Reverses the order of the rows in the image void LLImageRaw::verticalFlip() { + if (!getData()) + { + return; + } + S32 row_bytes = getWidth() * getComponents(); llassert(row_bytes > 0); std::vector<U8> line_buffer(row_bytes); @@ -666,6 +671,11 @@ void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) // Fill the buffer with a constant color void LLImageRaw::fill( const LLColor4U& color ) { + if (!getData()) + { + return; + } + S32 pixels = getWidth() * getHeight(); if( 4 == getComponents() ) { @@ -867,6 +877,11 @@ void LLImageRaw::copyScaled( LLImageRaw* src ) BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) { + if (!getData()) + { + return FALSE; + } + llassert((1 == getComponents()) || (3 == getComponents()) || (4 == getComponents()) ); S32 old_width = getWidth(); @@ -901,7 +916,7 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) copyLineScaled( &temp_buffer[0] + (getComponents() * old_width * row), new_buffer + (getComponents() * new_width * row), old_width, new_width, 1, 1 ); } } - else + else if (getData()) { // copy out existing image data S32 temp_data_size = old_width * old_height * getComponents(); @@ -1478,7 +1493,7 @@ void LLImageFormatted::sanityCheck() BOOL LLImageFormatted::copyData(U8 *data, S32 size) { - if ( data && ((data != getData()) || (size != getDataSize())) ) + if ( data && getData() && ((data != getData()) || (size != getDataSize())) ) { deleteData(); allocateData(size); @@ -1564,6 +1579,11 @@ BOOL LLImageFormatted::load(const std::string &filename, int load_size) BOOL LLImageFormatted::save(const std::string &filename) { + if (!getData()) + { + return FALSE; + } + resetLastError(); LLAPRFile outfile ; diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index 294f68b122..525aa8d78c 100755 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -94,6 +94,13 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) return FALSE; } + // Check to make sure that this instance has been initialized with data + if (!raw_image->getData()) + { + setLastError("LLImagePNG trying to decode an image into unallocated LLImageRaw!"); + return FALSE; + } + // Decode the PNG data into the raw image LLPngWrapper pngWrapper; if (!pngWrapper.isValidPng(getData())) diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index ad2eb0f69c..e425823c59 100755 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -142,8 +142,12 @@ bool LLImageDecodeThread::ImageRequest::processRequest() mFormattedImage->getHeight(), mFormattedImage->getComponents()); } - done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms - mDecodedRaw = done; + + //if (mDecodedImageRaw->getData())) + { + done = mFormattedImage->decode(mDecodedImageRaw, decode_time_slice); // 1ms + mDecodedRaw = done; + } } if (done && mNeedsAux && !mDecodedAux && mFormattedImage.notNull()) { @@ -154,8 +158,12 @@ bool LLImageDecodeThread::ImageRequest::processRequest() mFormattedImage->getHeight(), 1); } - done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms - mDecodedAux = done; + + //if (mDecodedImageAux->getData()) + { + done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms + mDecodedAux = done; + } } return done; diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 45a3b18179..0dad4285d9 100755 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -116,6 +116,11 @@ void LLCubeMap::initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages const U8 *sd = rawimages[i]->getData(); U8 *td = mRawImages[i]->getData(); + if (!sd || !td) + { + continue; + } + S32 offset = 0; S32 sx, sy, so; for (int y = 0; y < 64; y++) diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index 84c782e958..7ab4e93da5 100755 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -448,7 +448,11 @@ LLFontGlyphInfo* LLFontFreetype::addGlyphFromFont(const LLFontFreetype *fontp, l LLImageGL *image_gl = mFontBitmapCachep->getImageGL(bitmap_num); LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); - image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight()); + + if (image_gl) + { + image_gl->setSubImage(image_raw, 0, 0, image_gl->getWidth(), image_gl->getHeight()); + } return gi; } @@ -560,13 +564,18 @@ void LLFontFreetype::setSubImageLuminanceAlpha(U32 x, U32 y, U32 bitmap_num, U32 { LLImageRaw *image_raw = mFontBitmapCachep->getImageRaw(bitmap_num); + if (!image_raw) + { + return; + } + llassert(!mIsFallback); - llassert(image_raw && (image_raw->getComponents() == 2)); + llassert(image_raw->getComponents() == 2); U8 *target = image_raw->getData(); - if (!data) + if (!data || !target) { return; } diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index ab875141c5..315cc57e51 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1251,6 +1251,11 @@ BOOL LLImageGL::createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S return FALSE; } + if (!imageraw->getData()) + { + return FALSE; + } + mGLTextureCreated = false ; llassert(gGLManager.mInited); stop_glerror(); diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp index aac349bf57..49a1c9dba3 100755 --- a/indra/media_plugins/winmmshim/winmm_shim.cpp +++ b/indra/media_plugins/winmmshim/winmm_shim.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2010-2014, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,8 +30,8 @@ using std::wstring; -static float sVolumeLevel = 1.f; -static bool sMute = false; +static float sVolumeLevel = 1.f; // Could be covered by critical section, +static bool sMute = false; // not needed with atomicity and alignment. static CRITICAL_SECTION sCriticalSection; BOOL APIENTRY DllMain( HMODULE hModule, @@ -39,37 +39,44 @@ BOOL APIENTRY DllMain( HMODULE hModule, LPVOID lpReserved ) { - InitializeCriticalSection(&sCriticalSection); + if (DLL_PROCESS_ATTACH == ul_reason_for_call) + { + InitializeCriticalSection(&sCriticalSection); + } return TRUE; } void ll_winmm_shim_initialize(){ - static bool initialized = false; - // do this only once - EnterCriticalSection(&sCriticalSection); + static volatile bool initialized = false; + + // do this only once using double-check locking if (!initialized) - { // bind to original winmm.dll - TCHAR system_path[MAX_PATH]; - TCHAR dll_path[MAX_PATH]; - ::GetSystemDirectory(system_path, MAX_PATH); - - // grab winmm.dll from system path, where it should live - wsprintf(dll_path, "%s\\winmm.dll", system_path); - HMODULE winmm_handle = ::LoadLibrary(dll_path); - - if (winmm_handle != NULL) - { // we have a dll, let's get out pointers! - initialized = true; - init_function_pointers(winmm_handle); - ::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n"); - } - else - { - // failed to initialize real winmm.dll - ::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n"); + { + EnterCriticalSection(&sCriticalSection); + if (!initialized) + { // bind to original winmm.dll + TCHAR system_path[MAX_PATH]; + TCHAR dll_path[MAX_PATH]; + ::GetSystemDirectory(system_path, MAX_PATH); + + // grab winmm.dll from system path, where it should live + wsprintf(dll_path, "%s\\winmm.dll", system_path); + HMODULE winmm_handle = ::LoadLibrary(dll_path); + + if (winmm_handle != NULL) + { // we have a dll, let's get out pointers! + init_function_pointers(winmm_handle); + ::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n"); + initialized = true; // Last thing after completing setup + } + else + { + // failed to initialize real winmm.dll + ::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n"); + } } + LeaveCriticalSection(&sCriticalSection); } - LeaveCriticalSection(&sCriticalSection); } @@ -84,7 +91,7 @@ extern "C" int mBitsPerSample; }; typedef std::map<HWAVEOUT, WaveOutFormat*> wave_out_map_t; - static wave_out_map_t sWaveOuts; + static wave_out_map_t sWaveOuts; // Covered by sCriticalSection MMRESULT WINAPI waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen) { @@ -100,7 +107,9 @@ extern "C" && ((fdwOpen & WAVE_FORMAT_QUERY) == 0)) // not just querying for format support { // remember the requested bits per sample, and associate with the given handle WaveOutFormat* wave_outp = new WaveOutFormat(pwfx->wBitsPerSample); + EnterCriticalSection(&sCriticalSection); sWaveOuts.insert(std::make_pair(*phwo, wave_outp)); + LeaveCriticalSection(&sCriticalSection); } return result; } @@ -108,13 +117,15 @@ extern "C" MMRESULT WINAPI waveOutClose( HWAVEOUT hwo) { ll_winmm_shim_initialize(); + EnterCriticalSection(&sCriticalSection); wave_out_map_t::iterator found_it = sWaveOuts.find(hwo); if (found_it != sWaveOuts.end()) { // forget what we know about this handle delete found_it->second; sWaveOuts.erase(found_it); } - return waveOutClose_orig( hwo); + LeaveCriticalSection(&sCriticalSection); + return waveOutClose_orig(hwo); } MMRESULT WINAPI waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh) @@ -128,11 +139,19 @@ extern "C" } else if (sVolumeLevel != 1.f) { // need to apply volume level + int bits_per_sample(0); + + EnterCriticalSection(&sCriticalSection); wave_out_map_t::iterator found_it = sWaveOuts.find(hwo); if (found_it != sWaveOuts.end()) { - WaveOutFormat* formatp = found_it->second; - switch (formatp->mBitsPerSample){ + bits_per_sample = found_it->second->mBitsPerSample; + } + LeaveCriticalSection(&sCriticalSection); + if (bits_per_sample) + { + switch (bits_per_sample) + { case 8: { char volume = (char)(sVolumeLevel * 127.f); diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 0833a98f14..aaf18d2948 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -3.7.4 +3.7.5 diff --git a/indra/newview/lldeferredsounds.cpp b/indra/newview/lldeferredsounds.cpp index 9416e7cd29..e1613e4719 100755 --- a/indra/newview/lldeferredsounds.cpp +++ b/indra/newview/lldeferredsounds.cpp @@ -39,7 +39,10 @@ void LLDeferredSounds::playdeferredSounds() { while(soundVector.size()) { - gAudiop->triggerSound(soundVector.back()); + if (gAudiop) + { + gAudiop->triggerSound(soundVector.back()); + } soundVector.pop_back(); } } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 79a81cedda..24fe1dd75f 100755 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -1232,6 +1232,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI //if (iter->second->getWidth() != src->getWidth() || // iter->second->getHeight() != src->getHeight()) // bump not cached yet or has changed resolution + if (src->getData()) { LLPointer<LLImageRaw> dst_image = new LLImageRaw(src->getWidth(), src->getHeight(), 1); U8* dst_data = dst_image->getData(); diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index c3ec234223..d7ecacf2e6 100755 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -88,8 +88,11 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) : //gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get()); m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP); - mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN); - + if (mTexturep) + { + mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN); + } + //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } @@ -851,11 +854,18 @@ void LLDrawPoolTerrain::renderSimple() // Pass 1/1 // Stage 0: Base terrain texture pass - mTexturep->addTextureStats(1024.f*1024.f); + if (mTexturep) + { + mTexturep->addTextureStats(1024.f*1024.f); + } gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->bind(mTexturep); + + if (mTexturep) + { + gGL.getTexUnit(0)->bind(mTexturep); + } LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent(); F32 tscale = 1.f/256.f; diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 9490769d8c..e8c6b179cf 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -170,7 +170,6 @@ mRefreshBtn(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mCaptionTextBox(NULL), -mLocationCheckbox(NULL), mPostButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLSocialPhotoPanel::onSend, this)); @@ -196,7 +195,6 @@ BOOL LLSocialPhotoPanel::postBuild() mWorkingLabel = getChild<LLUICtrl>("working_lbl"); mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder"); mCaptionTextBox = getChild<LLUICtrl>("photo_caption"); - mLocationCheckbox = getChild<LLUICtrl>("add_location_cb"); mPostButton = getChild<LLUICtrl>("post_photo_btn"); mCancelButton = getChild<LLUICtrl>("cancel_photo_btn"); @@ -213,7 +211,6 @@ void LLSocialPhotoPanel::draw() mCaptionTextBox->setEnabled(no_ongoing_connection); mResolutionComboBox->setEnabled(no_ongoing_connection); mRefreshBtn->setEnabled(no_ongoing_connection); - mLocationCheckbox->setEnabled(no_ongoing_connection); // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) @@ -343,25 +340,6 @@ void LLSocialPhotoPanel::sendPhoto() // Get the caption std::string caption = mCaptionTextBox->getValue().asString(); - // Add the location if required - bool add_location = mLocationCheckbox->getValue().asBoolean(); - if (add_location) - { - // Get the SLURL for the location - LLSLURL slurl; - LLAgentUI::buildSLURL(slurl); - std::string slurl_string = slurl.getSLURLString(); - - // Add query parameters so Google Analytics can track incoming clicks! - slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; - - // Add it to the caption (pretty crude, but we don't have a better option with photos) - if (caption.empty()) - caption = slurl_string; - else - caption = caption + " " + slurl_string; - } - // Get the image LLSnapshotLivePreview* previewp = getPreviewView(); diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index bbe07c9704..309f015ce9 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -85,7 +85,6 @@ private: LLUICtrl * mWorkingLabel; LLUICtrl * mThumbnailPlaceholder; LLUICtrl * mCaptionTextBox; - LLUICtrl * mLocationCheckbox; LLUICtrl * mPostButton; LLUICtrl* mCancelButton; }; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 08b5eaedbb..193e2ea678 100755 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -798,7 +798,10 @@ void LLNetMap::createObjectImage() { mObjectRawImagep = new LLImageRaw(img_size, img_size, 4); U8* data = mObjectRawImagep->getData(); - memset( data, 0, img_size * img_size * 4 ); + if (data) + { + memset( data, 0, img_size * img_size * 4 ); + } mObjectImagep = LLViewerTextureManager::getLocalTexture( mObjectRawImagep.get(), FALSE); } setScale(mScale); diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index a50d9074f7..edcf0d0452 100755 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -876,7 +876,10 @@ void LLPanelNearByMedia::onClickParcelAudioPlay() // playing and updated as they cross to other parcels etc. mParcelAudioAutoStart = true; if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; return; + } if (LLAudioEngine::AUDIO_PAUSED == gAudiop->isInternetStreamPlaying()) { @@ -896,7 +899,10 @@ void LLPanelNearByMedia::onClickParcelAudioStop() // they explicitly start it again. mParcelAudioAutoStart = false; if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; return; + } LLViewerAudio::getInstance()->stopInternetStreamWithAutoFade(); } @@ -904,7 +910,10 @@ void LLPanelNearByMedia::onClickParcelAudioStop() void LLPanelNearByMedia::onClickParcelAudioPause() { if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; return; + } // 'true' means pause gAudiop->pauseInternetStream(true); diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index 39ec6def91..11b81a58fc 100755 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -55,7 +55,9 @@ BOOL LLPreviewSound::postBuild() { getChild<LLUICtrl>("desc")->setValue(item->getDescription()); if (gAudiop) + { gAudiop->preloadSound(item->getAssetUUID()); // preload the sound + } } childSetAction("Sound play btn",&LLPreviewSound::playSound,this); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index a5fdb72f9b..2f658e066f 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -624,25 +624,22 @@ bool idle_startup() if (FALSE == gSavedSettings.getBOOL("NoAudio")) { + delete gAudiop; gAudiop = NULL; #ifdef LL_FMODEX - if (!gAudiop #if !LL_WINDOWS - && NULL == getenv("LL_BAD_FMODEX_DRIVER") + if (NULL == getenv("LL_BAD_FMODEX_DRIVER")) #endif // !LL_WINDOWS - ) { gAudiop = (LLAudioEngine *) new LLAudioEngine_FMODEX(gSavedSettings.getBOOL("FMODExProfilerEnable")); } #endif #ifdef LL_OPENAL - if (!gAudiop #if !LL_WINDOWS - && NULL == getenv("LL_BAD_OPENAL_DRIVER") + if (NULL == getenv("LL_BAD_OPENAL_DRIVER")) #endif // !LL_WINDOWS - ) { gAudiop = (LLAudioEngine *) new LLAudioEngine_OpenAL(); } @@ -2687,7 +2684,7 @@ void init_start_screen(S32 location_id) } } - if(gStartTexture.isNull()) + if(gStartTexture && gStartTexture.isNull()) { gStartTexture = LLViewerTexture::sBlackImagep ; gStartImageWidth = gStartTexture->getWidth() ; diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 93c7f54101..f1b27279e3 100755 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -233,6 +233,12 @@ void LLSurface::createSTexture() // GL NOT ACTIVE HERE LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize, sTextureSize, 3); U8 *default_texture = raw->getData(); + + if (!default_texture) + { + return; + } + for (S32 i = 0; i < sTextureSize; i++) { for (S32 j = 0; j < sTextureSize; j++) @@ -257,6 +263,12 @@ void LLSurface::createWaterTexture() // Create the water texture LLPointer<LLImageRaw> raw = new LLImageRaw(sTextureSize/2, sTextureSize/2, 4); U8 *default_texture = raw->getData(); + + if (!default_texture) + { + return; + } + for (S32 i = 0; i < sTextureSize/2; i++) { for (S32 j = 0; j < sTextureSize/2; j++) diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 5bc2e971eb..8d9d2421da 100755 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1937,7 +1937,7 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 dis memcpy(mFastCachePadBuffer + sizeof(S32) * 3, &discardlevel, sizeof(S32)); S32 copy_size = w * h * c; - if(copy_size > 0) //valid + if(copy_size > 0 && raw->getData()) //valid { copy_size = llmin(copy_size, TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD); memcpy(mFastCachePadBuffer + TEXTURE_FAST_CACHE_ENTRY_OVERHEAD, raw->getData(), copy_size); diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 826d296117..fce42a1587 100755 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -93,7 +93,12 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) switch (mFadeState) { - case FADE_IDLE: + case FADE_IDLE: + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + break; + } // If a stream is playing fade it out first if (!gAudiop->getInternetStreamURL().empty()) { @@ -115,18 +120,18 @@ void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) break; } - case FADE_OUT: - startFading(); - registerIdleListener(); - break; + case FADE_OUT: + startFading(); + registerIdleListener(); + break; - case FADE_IN: - registerIdleListener(); - break; + case FADE_IN: + registerIdleListener(); + break; - default: - llwarns << "Unknown fading state: " << mFadeState << llendl; - break; + default: + llwarns << "Unknown fading state: " << mFadeState << llendl; + break; } } @@ -157,19 +162,26 @@ bool LLViewerAudio::onIdleUpdate() // we have finished the current fade operation if (mFadeState == FADE_OUT) { - // Clear URI - gAudiop->startInternetStream(LLStringUtil::null); - gAudiop->stopInternetStream(); + if (gAudiop) + { + // Clear URI + gAudiop->startInternetStream(LLStringUtil::null); + gAudiop->stopInternetStream(); + } if (!mNextStreamURI.empty()) { mFadeState = FADE_IN; - LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl(); - if(stream && stream->supportsAdjustableBufferSizes()) - stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize")); + if (gAudiop) + { + LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl(); + if(stream && stream->supportsAdjustableBufferSizes()) + stream->setBufferSizes(gSavedSettings.getU32("FMODExStreamBufferSize"),gSavedSettings.getU32("FMODExDecodeBufferSize")); + + gAudiop->startInternetStream(mNextStreamURI); + } - gAudiop->startInternetStream(mNextStreamURI); startFading(); } else @@ -181,7 +193,7 @@ bool LLViewerAudio::onIdleUpdate() } else if (mFadeState == FADE_IN) { - if (mNextStreamURI != gAudiop->getInternetStreamURL()) + if (gAudiop && mNextStreamURI != gAudiop->getInternetStreamURL()) { mFadeState = FADE_OUT; startFading(); @@ -203,9 +215,12 @@ void LLViewerAudio::stopInternetStreamWithAutoFade() mFadeState = FADE_IDLE; mNextStreamURI = LLStringUtil::null; mDone = true; - - gAudiop->startInternetStream(LLStringUtil::null); - gAudiop->stopInternetStream(); + + if (gAudiop) + { + gAudiop->startInternetStream(LLStringUtil::null); + gAudiop->stopInternetStream(); + } } void LLViewerAudio::startFading() @@ -267,7 +282,7 @@ F32 LLViewerAudio::getFadeVolume() void LLViewerAudio::onTeleportStarted() { - if (!LLViewerAudio::getInstance()->getForcedTeleportFade()) + if (gAudiop && !LLViewerAudio::getInstance()->getForcedTeleportFade()) { // Even though the music was turned off it was starting up (with autoplay disabled) occasionally // after a failed teleport or after an intra-parcel teleport. Also, the music sometimes was not @@ -393,9 +408,10 @@ void audio_update_volume(bool force_update) } F32 mute_volume = mute_audio ? 0.0f : 1.0f; - // Sound Effects if (gAudiop) { + // Sound Effects + gAudiop->setMasterGain ( master_volume ); gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler")); @@ -425,11 +441,9 @@ void audio_update_volume(bool force_update) gSavedSettings.getBOOL("MuteUI") ? 0.f : gSavedSettings.getF32("AudioLevelUI")); gAudiop->setSecondaryGain(LLAudioEngine::AUDIO_TYPE_AMBIENT, gSavedSettings.getBOOL("MuteAmbient") ? 0.f : gSavedSettings.getF32("AudioLevelAmbient")); - } - // Streaming Music - if (gAudiop) - { + // Streaming Music + if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade()) { LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty()); @@ -527,6 +541,12 @@ void audio_update_wind(bool force_update) volume_delta = 1.f; } + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return; + } + // mute wind when not flying if (gAgent.getFlying()) { diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 624f62e37e..031cedc80a 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4657,7 +4657,11 @@ void process_time_synch(LLMessageSystem *mesgsys, void **user_data) void process_sound_trigger(LLMessageSystem *msg, void **) { - if (!gAudiop) return; + if (!gAudiop) + { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; + return; + } U64 region_handle = 0; F32 gain = 0; @@ -4717,6 +4721,7 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) { if (!gAudiop) { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; return; } @@ -4747,9 +4752,9 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) LLVector3d pos_global = objectp->getPositionGlobal(); if (gAgent.canAccessMaturityAtGlobal(pos_global)) { - // Add audioData starts a transfer internally. - sourcep->addAudioData(datap, FALSE); -} + // Add audioData starts a transfer internally. + sourcep->addAudioData(datap, FALSE); + } } void process_attached_sound(LLMessageSystem *msg, void **user_data) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index e62998db70..c789719291 100755 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4950,6 +4950,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow { if (!gAudiop) { + LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; return; } @@ -5032,7 +5033,10 @@ LLAudioSource *LLViewerObject::getAudioSource(const LLUUID& owner_id) LLAudioSourceVO *asvop = new LLAudioSourceVO(mID, owner_id, 0.01f, this); mAudioSourcep = asvop; - if(gAudiop) gAudiop->addAudioSource(asvop); + if(gAudiop) + { + gAudiop->addAudioSource(asvop); + } } return mAudioSourcep; @@ -5040,10 +5044,6 @@ LLAudioSource *LLViewerObject::getAudioSource(const LLUUID& owner_id) void LLViewerObject::adjustAudioGain(const F32 gain) { - if (!gAudiop) - { - return; - } if (mAudioSourcep) { mAudioGain = gain; diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index a1c12c5cd6..fad77bce25 100755 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -76,10 +76,13 @@ LLViewerParcelOverlay::LLViewerParcelOverlay(LLViewerRegion* region, F32 region_ // // Create the base texture. U8 *raw = mImageRaw->getData(); - const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS; - for (S32 i = 0; i < COUNT; i++) + if (raw) { - raw[i] = 0; + const S32 COUNT = mParcelGridsPerEdge * mParcelGridsPerEdge * OVERLAY_IMG_COMPONENTS; + for (S32 i = 0; i < COUNT; i++) + { + raw[i] = 0; + } } //mTexture->setSubImage(mImageRaw, 0, 0, mParcelGridsPerEdge, mParcelGridsPerEdge); @@ -380,10 +383,13 @@ void LLViewerParcelOverlay::updateOverlayTexture() break; } - raw[pixel_index + 0] = (U8)r; - raw[pixel_index + 1] = (U8)g; - raw[pixel_index + 2] = (U8)b; - raw[pixel_index + 3] = (U8)a; + if (raw) + { + raw[pixel_index + 0] = (U8)r; + raw[pixel_index + 1] = (U8)g; + raw[pixel_index + 2] = (U8)b; + raw[pixel_index + 3] = (U8)a; + } pixel_index += OVERLAY_IMG_COMPONENTS; } diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 3da6d33d72..6364eee3ec 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -337,6 +337,11 @@ void LLViewerTextureManager::init() const S32 dim = 128; LLPointer<LLImageRaw> image_raw = new LLImageRaw(dim,dim,3); U8* data = image_raw->getData(); + + if (!data) + { + return; + } memset(data, 0, dim * dim * 3) ; LLViewerTexture::sBlackImagep = LLViewerTextureManager::getLocalTexture(image_raw.get(), TRUE) ; @@ -373,8 +378,12 @@ void LLViewerTextureManager::init() #else LLViewerFetchedTexture::sDefaultImagep = LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, TRUE, LLGLTexture::BOOST_UI); #endif - LLViewerFetchedTexture::sDefaultImagep->dontDiscard(); - LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ; + + if (LLViewerFetchedTexture::sDefaultImagep) + { + LLViewerFetchedTexture::sDefaultImagep->dontDiscard(); + LLViewerFetchedTexture::sDefaultImagep->setCategory(LLGLTexture::OTHER) ; + } LLViewerFetchedTexture::sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); LLViewerFetchedTexture::sSmokeImagep->setNoDelete() ; @@ -690,7 +699,7 @@ bool LLViewerTexture::bindDefaultImage(S32 stage) if (stage < 0) return false; bool res = true; - if (LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get())) + if (LLViewerFetchedTexture::sDefaultImagep && LLViewerFetchedTexture::sDefaultImagep.notNull() && (this != LLViewerFetchedTexture::sDefaultImagep.get())) { // use default if we've got it res = gGL.getTexUnit(stage)->bind(LLViewerFetchedTexture::sDefaultImagep); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index be4af23d07..bef032a404 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -438,10 +438,7 @@ public: } if (gDisplayWindInfo) { - if (gAudiop) - { - audio_text= llformat("Audio for wind: %d", gAudiop->isWindEnabled()); - } + audio_text = llformat("Audio for wind: %d", gAudiop ? gAudiop->isWindEnabled() : -1); addText(xpos, ypos, audio_text); ypos += y_inc; } if (gDisplayFOV) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 082a85e217..ca004962d5 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -818,7 +818,8 @@ void LLVOAvatarSelf::setLocalTextureTE(U8 te, LLViewerTexture* image, U32 index) return; } - if (getTEImage(te)->getID() == image->getID()) + LLViewerTexture * tx = getTEImage(te); + if (!tx || tx->getID() == image->getID()) { return; } @@ -1698,6 +1699,7 @@ S32 LLVOAvatarSelf::getLocalDiscardLevel(ETextureIndex type, U32 wearable_index) const LLViewerFetchedTexture* image = dynamic_cast<LLViewerFetchedTexture*>( local_tex_obj->getImage() ); if (type >= 0 && local_tex_obj->getID() != IMG_DEFAULT_AVATAR + && image && !image->isMissingAsset()) { return image->getDiscardLevel(); @@ -2036,7 +2038,10 @@ BOOL LLVOAvatarSelf::getIsCloud() const /*static*/ void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) { - gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata); + if (gAgentAvatarp) + { + gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata); + } } void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata) diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 93f0e50336..467152881e 100755 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -257,18 +257,21 @@ LLSkyTex::~LLSkyTex() void LLSkyTex::initEmpty(const S32 tex) { U8* data = mImageRaw[tex]->getData(); - for (S32 i = 0; i < sResolution; ++i) + if (data) { - for (S32 j = 0; j < sResolution; ++j) + for (S32 i = 0; i < sResolution; ++i) { - const S32 basic_offset = (i * sResolution + j); - S32 offset = basic_offset * sComponents; - data[offset] = 0; - data[offset+1] = 0; - data[offset+2] = 0; - data[offset+3] = 255; - - mSkyData[basic_offset].setToBlack(); + for (S32 j = 0; j < sResolution; ++j) + { + const S32 basic_offset = (i * sResolution + j); + S32 offset = basic_offset * sComponents; + data[offset] = 0; + data[offset+1] = 0; + data[offset+2] = 0; + data[offset+3] = 255; + + mSkyData[basic_offset].setToBlack(); + } } } @@ -279,17 +282,21 @@ void LLSkyTex::create(const F32 brightness) { /// Brightness ignored for now. U8* data = mImageRaw[sCurrent]->getData(); - for (S32 i = 0; i < sResolution; ++i) + if (data) { - for (S32 j = 0; j < sResolution; ++j) + for (S32 i = 0; i < sResolution; ++i) { - const S32 basic_offset = (i * sResolution + j); - S32 offset = basic_offset * sComponents; - U32* pix = (U32*)(data + offset); - LLColor4U temp = LLColor4U(mSkyData[basic_offset]); - *pix = temp.mAll; + for (S32 j = 0; j < sResolution; ++j) + { + const S32 basic_offset = (i * sResolution + j); + S32 offset = basic_offset * sComponents; + U32* pix = (U32*)(data + offset); + LLColor4U temp = LLColor4U(mSkyData[basic_offset]); + *pix = temp.mAll; + } } } + createGLImage(sCurrent); } diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 85614f397c..27256af97a 100755 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -101,15 +101,21 @@ LLWorld::LLWorld() : LLPointer<LLImageRaw> raw = new LLImageRaw(1,1,4); U8 *default_texture = raw->getData(); - *(default_texture++) = MAX_WATER_COLOR.mV[0]; - *(default_texture++) = MAX_WATER_COLOR.mV[1]; - *(default_texture++) = MAX_WATER_COLOR.mV[2]; - *(default_texture++) = MAX_WATER_COLOR.mV[3]; - - mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); - gGL.getTexUnit(0)->bind(mDefaultWaterTexturep); - mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); + if (default_texture) + { + *(default_texture++) = MAX_WATER_COLOR.mV[0]; + *(default_texture++) = MAX_WATER_COLOR.mV[1]; + *(default_texture++) = MAX_WATER_COLOR.mV[2]; + *(default_texture++) = MAX_WATER_COLOR.mV[3]; + } + + if (mDefaultWaterTexturep) + { + mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + gGL.getTexUnit(0)->bind(mDefaultWaterTexturep); + mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); + } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index ab6e5cc353..725fe1ffdd 100755 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4411,9 +4411,11 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) sUnderWaterRender = FALSE; } - gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep); - LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP); - + if (LLViewerFetchedTexture::sDefaultImagep) + { + gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sDefaultImagep); + LLViewerFetchedTexture::sDefaultImagep->setAddressMode(LLTexUnit::TAM_WRAP); + } ////////////////////////////////////////////// // diff --git a/indra/newview/skins/default/xui/en/panel_social_photo.xml b/indra/newview/skins/default/xui/en/panel_social_photo.xml index a55613b52a..c79a246d9d 100644 --- a/indra/newview/skins/default/xui/en/panel_social_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_social_photo.xml @@ -113,14 +113,6 @@ type="string" word_wrap="true"> </text_editor> - <check_box - follows="left|top" - initial_value="true" - label="Include location in posting" - name="add_location_cb" - left="9" - height="16" - top_pad="8"/> </layout_panel> <layout_panel name="photo_button_panel" diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index fe0774b409..f7b3a45e8d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -7,7 +7,7 @@ $LicenseInfo:firstyear=2006&license=viewerlgpl$ Second Life Viewer Source Code -Copyright (C) 2006-2011, Linden Research, Inc. +Copyright (C) 2006-2014, Linden Research, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -749,7 +749,6 @@ class Darwin_i386_Manifest(ViewerManifest): "libcollada14dom.dylib", "libexpat.1.5.2.dylib", "libexception_handler.dylib", - "libfmodex.dylib", "libGLOD.dylib", ): dylibs += path_optional(os.path.join(libdir, libfile), libfile) @@ -765,6 +764,20 @@ class Darwin_i386_Manifest(ViewerManifest): 'SLVoice', ): self.path2basename(libdir, libfile) + + # dylibs that vary based on configuration + if self.args['configuration'].lower() == 'debug': + for libfile in ( + "libfmodexL.dylib", + ): + dylibs += path_optional(os.path.join("../packages/lib/debug", + libfile), libfile) + else: + for libfile in ( + "libfmodex.dylib", + ): + dylibs += path_optional(os.path.join("../packages/lib/release", + libfile), libfile) # our apps for app_bld_dir, app in (("mac_crash_logger", "mac-crash-logger.app"), |