Closed
Bug 1943217
Opened 1 month ago
Closed 1 month ago
Result's `unwrap()` will affect its value, make descendants `unwrap()` return wrong value
Categories
(Core :: MFBT, defect)
Core
MFBT
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: alwu, Unassigned)
Details
I'm not sure if this is intended or a bug, and I discover this issue in this code.
For the debug purpose, I added following logs.
uint8_t numSPS = config1.unwrap().NumSPS();
auto numSPS2 = config2.unwrap().NumSPS();
if (numSPS == 0 || numSPS != numSPS2) {
return false;
}
printf_stderr("DD | ### num1=%u, num2=%u\n", numSPS, numSPS2);
for (auto idx = 0; idx < 3; idx++) {
printf_stderr("DD | loop %u, num1=%u, num2=%u\n", idx,
config1.unwrap().NumSPS(), config2.unwrap().NumSPS());
}
What I expect is calling unwrap()
won't affect the successful value in the Result
. The NumSPS()
in the first printf
should be identical with other printf
in the loop. However, after running above codes, I got the result like below,
DD | ### num1=1, num2=1
DD | loop 0, num1=0, num2=0
DD | loop 1, num1=0, num2=0
DD | loop 2, num1=0, num2=0
After calling unwrap()
, it alters the successful value of HVCCConfig
. Make the following unwrap()
calls return an incorrect value. I can reproduce this issue by playing this file on Windows.
Comment 1•1 month ago
|
||
This is intended. Once you unwrap, the Result is not valid anymore. Of course, this being C++, you still can use the variable, leading to your mistake.
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•