improvements to avoids crashes - #13615
Conversation
5fde662 to
3b9251c
Compare
|
|
||
| // Enumerate all imaging devices | ||
| for (int member_index = 0; ; ++member_index) | ||
| for (DWORD member_index = 0; member_index < 0x10000; ++member_index) |
There was a problem hiding this comment.
Can you explain? add comment? why < 0x10000?
There was a problem hiding this comment.
This is only some limit to avoid infinite loop. No real meaning for this number - only assuming that there will be no system with 0x10000 (65,536) devices.
I ll add a comment.
| break; // stop when none left | ||
| continue; // silently ignore other errors | ||
| DWORD last_error = GetLastError(); | ||
| if ((last_error == ERROR_NO_MORE_ITEMS) || (last_error == ERROR_INVALID_HANDLE)) |
There was a problem hiding this comment.
Can you also explain why this was added?
There was a problem hiding this comment.
The customer was complaining that the error ERROR_INVALID_HANDLE happened sometimes, and that this was leading to infinite loop (see in ticket).
There was a problem hiding this comment.
I wonder if this can happen when looping the devices even if not finished yet or only after.
If we will get it in the middle we will nor enumerate the device right?
On Linux it will be forever as the trigger is udev.
We need to make sure we need to break on the first time we see this
|
|
||
| // Enumerate all imaging devices | ||
| for (int member_index = 0; ; ++member_index) | ||
| // high limit is below loop has been added to avoid infinite loop |
There was a problem hiding this comment.
0x10000 is a large enough limit to avoid...
8a14959 to
bd6a0aa
Compare
Tracked by: RSDSO-19908