fix(validator): fix double-lock crash when pos and UV share the same vertex buffer - #247
Conversation
…vertex buffer Most mesh formats store positions and UVs interleaved in a single hardware buffer. doValidate() locked the position buffer then immediately tried to lock the UV buffer again — when both elements share the same binding source index this throws Ogre's "already locked" RuntimeAssertionException, crashing the app on all platforms. Fix: check whether texElem->getSource() == posElem->getSource() before locking the UV buffer. If they share the same buffer, reuse the already-locked data pointer and stride instead of locking again. The separate tbuf->unlock() is skipped in the shared case to avoid a double-unlock. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 40 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe change fixes a double-locking issue in UV validation where texture coordinates and vertex positions share the same source buffer. When buffers are shared, the code reuses the already-locked vertex pointer instead of acquiring a separate lock, and conditionally skips unlocking to prevent errors. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/MeshValidator.cpp`:
- Around line 202-203: The UV out-of-range check currently uses u < -10.f || u >
11.f (and similar for v), which skips values between 10 and 11; update the
conditional that increments totalOutOfRangeUV to use symmetric ±10 thresholds (u
< -10.f || u > 10.f and v < -10.f || v > 10.f) so any UV outside ±10 is counted;
locate and modify the conditional that refers to totalOutOfRangeUV in
MeshValidator.cpp and adjust both u and v comparisons accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
- qtmesh validate <file> [--json]: runs MeshValidator::doValidate() and reports geometry issues (degenerate triangles, non-finite/extreme UVs); exits 1 if any error-type issues found, 0 if clean - qtmesh lod <file> --count N [--reductions r,...] [-o output]: generates N LOD levels and exports each as <base>_lodN.<ext>; if -o is omitted, names are derived from the input file path - qtmesh lod <file> --auto [-o output]: auto-generates LOD levels - qtmesh lod <file> --remove [-o output]: strips LOD levels and saves - qtmesh lod <file> --info [--json]: shows LOD level triangle counts - Both subcommands recognized as CLI mode activators in main.cpp - Sentry breadcrumbs added for all new operations - Tests added for arg-parsing error paths and Ogre-based logic (skipped gracefully on macOS where plugins are unavailable) - CLAUDE.md and printUsage() updated with new subcommand docs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sh allowlist - MeshValidator: fix asymmetric UV out-of-range check — was u > 11.f, now u > 10.f (consistent with the stated ±10 threshold and the warning description text) - CI: add ViewCubeControllerOgreTest to GL_CRASH_ALLOWLIST — the suite uses a real OgreWidget/GL context and segfaults under Mesa/Xvfb on Linux CI, same root cause as SpaceCameraWidgetIntegrationTest Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|



Summary
doValidate()locked the position vertex buffer, then immediately tried to lock the UV buffer — when positions and UVs are interleaved in the same hardware buffer (the common case for most mesh formats), this throws Ogre's"already locked" RuntimeAssertionException, crashing the app on all platforms.texElem->getSource()withposElem->getSource()before locking the UV buffer. If they share the same binding index, reuse the already-locked data pointer and vertex stride instead of locking again. The separatetbuf->unlock()is also skipped in the shared-buffer case to prevent a double-unlock.Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit