A data-processing pipeline has reported that sensor readings become corrupted after frame duplication. The issue appears only when SensorFrame objects are copied. A minimal reproduction has been provided.
Your task is to investigate why the corruption occurs, identify the underlying ownership flaw, and update the class implementation so copied frames operate independently.
After your fix:
Program Flow:
Before fixing the class:
A and B both reflect the modification.
After fixing the class:
Only B reflects the modification; A must remain unchanged.
Example Input:
1 2 3 4 5 6 7 8
Example Output (After Fix):
1 2 3 4 5 6 7 8
1 2 3 99 5 6 7 8
Constraints:
Input
1 2 3 4 5 6 7 8
Expected Output
1 2 3 4 5 6 7 8 1 2 3 99 5 6 7 8