summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-05-19 00:50:58 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-05-19 03:51:06 +0300
commitdf844170600608b37c2725f7a263f1de3b055618 (patch)
treec40bfe4e82c987ccac3e5eda2c9e7ea4da025adf
parentd4d94580f50b0aa2d272399d2bbff529c3a37eca (diff)
#5818 Fix setCursor crash
reshape tried to setCursor before postBuild
-rw-r--r--indra/llui/lllineeditor.cpp7
-rw-r--r--indra/newview/llpanelprofilepicks.cpp5
-rw-r--r--indra/newview/llpanelprofilepicks.h16
3 files changed, 16 insertions, 12 deletions
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index ef62666918..0eef842a30 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -491,12 +491,13 @@ void LLLineEditor::setCursor( S32 pos )
S32 pixels_after_scroll = findPixelNearestPos();
if( pixels_after_scroll > mTextRightEdge )
{
- S32 width_chars_to_left = mGLFont->getWidth(mText.getWString().c_str(), 0, mScrollHPos);
- S32 last_visible_char = mGLFont->maxDrawableChars(mText.getWString().c_str(), llmax(0.f, (F32)(mTextRightEdge - mTextLeftEdge + width_chars_to_left)));
+ const LLWString& wtext = mText.getWString();
+ S32 width_chars_to_left = mGLFont->getWidth(wtext.c_str(), 0, mScrollHPos);
+ S32 last_visible_char = mGLFont->maxDrawableChars(wtext.c_str(), llmax(0.f, (F32)(mTextRightEdge - mTextLeftEdge + width_chars_to_left)));
// character immediately to left of cursor should be last one visible (SCROLL_INCREMENT_ADD will scroll in more characters)
// or first character if cursor is at beginning
S32 new_last_visible_char = llmax(0, getCursor() - 1);
- S32 min_scroll = mGLFont->firstDrawableChar(mText.getWString().c_str(), (F32)(mTextRightEdge - mTextLeftEdge), mText.length(), new_last_visible_char);
+ S32 min_scroll = mGLFont->firstDrawableChar(wtext.c_str(), (F32)(mTextRightEdge - mTextLeftEdge), mText.length(), new_last_visible_char);
if (old_cursor_pos == last_visible_char)
{
mScrollHPos = llmin(mText.length(), llmax(min_scroll, mScrollHPos + SCROLL_INCREMENT_ADD));
diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp
index 2e5b6707f1..6870d719af 100644
--- a/indra/newview/llpanelprofilepicks.cpp
+++ b/indra/newview/llpanelprofilepicks.cpp
@@ -655,7 +655,10 @@ bool LLPanelProfilePick::postBuild()
void LLPanelProfilePick::reshape(S32 width, S32 height, bool called_from_parent)
{
LLPanelProfilePropertiesProcessorTab::reshape(width, height, called_from_parent);
- mPickLocation->setCursor(0);
+ if (mPickLocation)
+ {
+ mPickLocation->setCursor(0);
+ }
}
void LLPanelProfilePick::onDescriptionFocusReceived()
diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h
index 1a378b470b..b925f09f92 100644
--- a/indra/newview/llpanelprofilepicks.h
+++ b/indra/newview/llpanelprofilepicks.h
@@ -230,14 +230,14 @@ public:
protected:
- LLTextureCtrl* mSnapshotCtrl;
- LLLineEditor* mPickName;
- LLTextEditor* mPickDescription;
- LLLineEditor* mPickLocation;
- LLButton* mSetCurrentLocationButton;
- LLButton* mSaveButton;
- LLButton* mCreateButton;
- LLButton* mCancelButton;
+ LLTextureCtrl* mSnapshotCtrl = nullptr;
+ LLLineEditor* mPickName = nullptr;
+ LLTextEditor* mPickDescription = nullptr;
+ LLLineEditor* mPickLocation = nullptr;
+ LLButton* mSetCurrentLocationButton = nullptr;
+ LLButton* mSaveButton = nullptr;
+ LLButton* mCreateButton = nullptr;
+ LLButton* mCancelButton = nullptr;
LLVector3d mPosGlobal;
LLUUID mParcelId;