From f448e2a446c5a24509bc8a609851316e3953caab Mon Sep 17 00:00:00 2001 From: Drake Arconis <drake@alchemyviewer.org> Date: Wed, 30 Aug 2017 15:44:04 -0400 Subject: [PATCH] Crash fixes. --- indra/newview/llimview.cpp | 3 +- indra/newview/llmediactrl.h | 2 ++ indra/newview/llpanelsnapshotpostcard.cpp | 2 ++ indra/newview/llpreviewscript.cpp | 43 ++++++++++++++++------- indra/newview/llpreviewscript.h | 2 ++ indra/newview/llviewerobjectlist.cpp | 7 +++- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a01e828b2c..617f5ab87b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -3696,8 +3696,7 @@ public: } //K now we want to accept the invitation - std::string url = gAgent.getRegion()->getCapability( - "ChatSessionRequest"); + std::string url = gAgent.getRegionCapability("ChatSessionRequest"); if (!url.empty()) { diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index 985c94e184..9b4a19a531 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -174,6 +174,8 @@ public: bool wantsKeyUpKeyDown() const override; bool wantsReturnKey() const override; + virtual BOOL acceptsTextInput() const { return TRUE; } + protected: void convertInputCoords(S32& x, S32& y); diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp index 133cae4b99..0ed8dc8d34 100644 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ b/indra/newview/llpanelsnapshotpostcard.cpp @@ -166,6 +166,8 @@ void LLPanelSnapshotPostcard::sendPostcardFinished(LLSD result) void LLPanelSnapshotPostcard::sendPostcard() { + if (!gAgent.getRegion()) return; + // upload the image std::string url = gAgent.getRegion()->getCapability("SendPostcard"); if (!url.empty()) diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index d9444f088d..c7c020e6e4 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -589,6 +589,23 @@ void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid) } } +std::string LLScriptEdCore::getScriptText() +{ + if (mEditor) + { + return mEditor->getText(); + } + return LLStringUtil::null; +} + +void LLScriptEdCore::makeEditorPristine() +{ + if (mEditor) + { + mEditor->makePristine(); + } +} + bool LLScriptEdCore::loadScriptText(const std::string& filename) { if (filename.empty()) @@ -644,7 +661,7 @@ bool LLScriptEdCore::writeToFile(const std::string& filename) return false; } - std::string utf8text = mEditor->getText(); + std::string utf8text = getScriptText(); // Special case for a completely empty script - stuff in one space so it can store properly. See SL-46889 if (utf8text.size() == 0) @@ -1248,7 +1265,7 @@ void LLScriptEdCore::onBtnSaveToFile( void* userdata ) if( file_picker.getSaveFile( LLFilePicker::FFSAVE_SCRIPT, self->mScriptName ) ) { std::string filename = file_picker.getFirstFile(); - std::string scriptText=self->mEditor->getText(); + std::string scriptText=self->getScriptText(); llofstream fout(filename.c_str()); fout<<(scriptText); fout.close(); @@ -1616,7 +1633,7 @@ void LLPreviewLSL::loadAsset() else { mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), FALSE); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); mScriptEd->mFunctions->setEnabled(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; } @@ -1704,7 +1721,7 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) mPendingUploads = 0; mScriptEd->mErrorList->deleteAllItems(); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); if (sync) { @@ -1725,7 +1742,7 @@ void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/) std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent"); if (!url.empty()) { - std::string buffer(mScriptEd->mEditor->getText()); + std::string buffer(mScriptEd->getScriptText()); LLBufferedAssetUploadInfo::invnUploadFinish_f proc = boost::bind(&LLPreviewLSL::finishedLSLUpload, _1, _4); LLResourceUploadInfo::ptr_t uploadInfo(new LLScriptAssetUpload(mItemUUID, buffer, proc)); @@ -1756,7 +1773,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset // put a EOS at the end buffer[file_length] = 0; preview->mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); - preview->mScriptEd->mEditor->makePristine(); + preview->mScriptEd->makeEditorPristine(); LLInventoryItem* item = gInventory.getItem(*item_uuid); BOOL is_modifiable = FALSE; if(item @@ -1841,7 +1858,7 @@ BOOL LLLiveLSLEditor::postBuild() childSetCommitCallback("mono", &LLLiveLSLEditor::onMonoCheckboxClicked, this); getChildView("mono")->setEnabled(FALSE); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); mScriptEd->mEditor->setFocus(TRUE); @@ -1932,7 +1949,7 @@ void LLLiveLSLEditor::loadAsset() { mItem = new LLViewerInventoryItem(item); mScriptEd->setScriptText(getString("not_allowed"), FALSE); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); mScriptEd->enableSave(FALSE); mAssetStatus = PREVIEW_ASSET_LOADED; } @@ -1967,7 +1984,7 @@ void LLLiveLSLEditor::loadAsset() if(mItem.isNull()) { mScriptEd->setScriptText(LLStringUtil::null, FALSE); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); mAssetStatus = PREVIEW_ASSET_LOADED; mIsModifiable = FALSE; } @@ -2070,7 +2087,7 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType buffer[file_length] = '\0'; mScriptEd->setScriptText(LLStringExplicit(&buffer[0]), TRUE); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); mScriptEd->setScriptName(getItem()->getName()); } @@ -2258,9 +2275,9 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) // save the script mScriptEd->enableSave(FALSE); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); mScriptEd->mErrorList->deleteAllItems(); - mScriptEd->mEditor->makePristine(); + mScriptEd->makeEditorPristine(); if (sync) { @@ -2274,7 +2291,7 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/) if (!url.empty()) { - std::string buffer(mScriptEd->mEditor->getText()); + std::string buffer(mScriptEd->getScriptText()); LLBufferedAssetUploadInfo::taskUploadFinish_f proc = boost::bind(&LLLiveLSLEditor::finishLSLUpload, _1, _2, _3, _4, isRunning); LLResourceUploadInfo::ptr_t uploadInfo(new LLScriptAssetUpload(mObjectUUID, mItemUUID, diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h index 7e2820f427..1936b7c86f 100644 --- a/indra/newview/llpreviewscript.h +++ b/indra/newview/llpreviewscript.h @@ -85,6 +85,8 @@ public: bool canLoadOrSaveToFile( void* userdata ); void setScriptText(const std::string& text, BOOL is_valid); + std::string getScriptText(); + void makeEditorPristine(); bool loadScriptText(const std::string& filename); bool writeToFile(const std::string& filename); void sync(); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 53cfb9caa4..d9d8ef9125 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1256,9 +1256,11 @@ void LLViewerObjectList::clearDebugText() void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) { + bool new_dead_object = true; if (mDeadObjects.find(objectp->mID) != mDeadObjects.end()) { LL_INFOS() << "Object " << objectp->mID << " already on dead list!" << LL_ENDL; + new_dead_object = false; } else { @@ -1295,7 +1297,10 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) // Also, not cleaned up removeDrawable(objectp->mDrawable); - mNumDeadObjects++; + if (new_dead_object) + { + mNumDeadObjects++; + } } static LLTrace::BlockTimerStatHandle FTM_REMOVE_DRAWABLE("Remove Drawable"); -- GitLab