Skip to content

Commit 9c0842b

Browse files
RyeMuttclaude
andcommitted
Address CodeRabbit review feedback
- llscrollbar: clear the residue when a sub-notch wheel event is forwarded to a parent scroller at a boundary, so reversing direction responds immediately instead of first unwinding leftover fraction. - lldxhardware: QueryInterface to IDXGIAdapter3 (not a reinterpret_cast of the IDXGIAdapter from EnumAdapters), and zero-init + HRESULT-check QueryVideoMemoryInfo before reading info.Budget. - llappviewersdl: SendMessageTimeout (SMTO_ABORTIFHUNG, 2s) for the second- instance SLURL handoff so a hung primary can't block startup; require delivery before treating the URL as handed off. - llviewercontrol / llviewerwindow: clamp NumpadControl to the valid enum range before the e_numpad_distinct cast. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8b30fd9 commit 9c0842b

5 files changed

Lines changed: 50 additions & 11 deletions

File tree

indra/llui/llscrollbar.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,21 @@ bool LLScrollbar::scrollByWheel(F32 precise)
428428
// that.
429429
if (precise > 0.f)
430430
{
431-
return mDocPos < getDocPosMax();
431+
if (mDocPos < getDocPosMax())
432+
{
433+
return true;
434+
}
435+
mScrollWheelResidue = 0.f; // forwarding to parent; don't keep partial progress
436+
return false;
432437
}
433438
if (precise < 0.f)
434439
{
435-
return mDocPos > 0;
440+
if (mDocPos > 0)
441+
{
442+
return true;
443+
}
444+
mScrollWheelResidue = 0.f; // forwarding to parent; don't keep partial progress
445+
return false;
436446
}
437447
return false;
438448
}

indra/llwindow/lldxhardware.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,11 @@ void LLDXHardware::updateVRAMBudgetFromDXGI()
486486
}
487487
else
488488
{
489-
IDXGIAdapter3* p_dxgi_adapter = nullptr;
489+
IDXGIAdapter* p_dxgi_adapter = nullptr;
490490
UINT graphics_adapter_index = 0;
491491
while (true)
492492
{
493-
res = p_factory->EnumAdapters(graphics_adapter_index, reinterpret_cast<IDXGIAdapter**>(&p_dxgi_adapter));
493+
res = p_factory->EnumAdapters(graphics_adapter_index, &p_dxgi_adapter);
494494
if (FAILED(res))
495495
{
496496
if (graphics_adapter_index == 0)
@@ -502,8 +502,25 @@ void LLDXHardware::updateVRAMBudgetFromDXGI()
502502
{
503503
if (graphics_adapter_index == 0) // Should it check largest one isntead of first?
504504
{
505-
DXGI_QUERY_VIDEO_MEMORY_INFO info;
506-
p_dxgi_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info);
505+
// EnumAdapters hands back an IDXGIAdapter; QueryInterface up
506+
// to IDXGIAdapter3 for QueryVideoMemoryInfo (Win10+). Zero-init
507+
// info and check the HRESULT so a failed query can't feed
508+
// garbage Budget into the VRAM estimate (it just leaves it 0).
509+
IDXGIAdapter3* p_dxgi_adapter3 = nullptr;
510+
DXGI_QUERY_VIDEO_MEMORY_INFO info = {};
511+
if (SUCCEEDED(p_dxgi_adapter->QueryInterface(__uuidof(IDXGIAdapter3), (void**)&p_dxgi_adapter3)) && p_dxgi_adapter3)
512+
{
513+
if (FAILED(p_dxgi_adapter3->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info)))
514+
{
515+
info = {};
516+
LL_WARNS() << "QueryVideoMemoryInfo failed" << LL_ENDL;
517+
}
518+
p_dxgi_adapter3->Release();
519+
}
520+
else
521+
{
522+
LL_WARNS() << "IDXGIAdapter3 unavailable; skipping DXGI VRAM budget" << LL_ENDL;
523+
}
507524

508525
// Alternatively use GetDesc from below to get adapter's memory
509526
UINT64 budget_mb = info.Budget / (1024 * 1024);

indra/newview/llappviewersdl.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,9 +1032,17 @@ bool LLAppViewerSDL::sendURLToOtherInstance(const std::string& url)
10321032
cds.cbData = static_cast<DWORD>(url.length()) + 1;
10331033
cds.lpData = (void*)url.c_str();
10341034

1035-
LRESULT msg_result = SendMessage(other_window, WM_COPYDATA, NULL, (LPARAM)&cds);
1036-
LL_DEBUGS() << "SendMessage(WM_COPYDATA) to other window '" << getWindowTitle() << "' returned " << msg_result << LL_ENDL;
1037-
return true;
1035+
// SendMessageTimeout (not SendMessage) so a hung/busy primary instance
1036+
// can't block this instance's startup; SMTO_ABORTIFHUNG bails fast. Our
1037+
// WM_COPYDATA handler returns TRUE on receipt, so require both a
1038+
// successful send and a non-zero result before treating the URL as
1039+
// handed off — otherwise fall through (return false) and handle it here.
1040+
DWORD_PTR msg_result = 0;
1041+
LRESULT sent = SendMessageTimeout(other_window, WM_COPYDATA, NULL, (LPARAM)&cds,
1042+
SMTO_ABORTIFHUNG, 2000, &msg_result);
1043+
LL_DEBUGS() << "SendMessageTimeout(WM_COPYDATA) to other window '" << getWindowTitle()
1044+
<< "' sent=" << sent << " result=" << msg_result << LL_ENDL;
1045+
return sent != 0 && msg_result != 0;
10381046
}
10391047
return false;
10401048
}

indra/newview/llviewercontrol.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ static bool handleNumpadControlChanged(const LLSD& newvalue)
193193
{
194194
if (gKeyboard)
195195
{
196-
gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(newvalue.asInteger()));
196+
// Clamp persisted/out-of-range values to the valid enum range so an
197+
// edited settings file can't push the keyboard into an undefined mode.
198+
S32 mode = llclamp(newvalue.asInteger(), (S32)LLKeyboard::ND_NEVER, (S32)LLKeyboard::ND_NUMLOCK_ON);
199+
gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(mode));
197200
}
198201
return true;
199202
}

indra/newview/llviewerwindow.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2317,7 +2317,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
23172317
// keeps it in sync on subsequent changes.
23182318
if (gKeyboard)
23192319
{
2320-
gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(gSavedSettings.getS32("NumpadControl")));
2320+
S32 numpad_mode = llclamp(gSavedSettings.getS32("NumpadControl"), (S32)LLKeyboard::ND_NEVER, (S32)LLKeyboard::ND_NUMLOCK_ON);
2321+
gKeyboard->setNumpadDistinct(static_cast<LLKeyboard::e_numpad_distinct>(numpad_mode));
23212322
}
23222323

23232324
mDebugText = new LLDebugText(this);

0 commit comments

Comments
 (0)