Conversation
| panda_cb_list *plist; | ||
| for(plist = panda_cbs[PANDA_CB_INSN_EXEC]; plist != NULL; plist = panda_cb_list_next(plist)) { | ||
| for(plist = panda_cbs[PANDA_CB_INSN_EXEC]; | ||
| (plist != NULL && panda_cbs[PANDA_CB_INSN_EXEC] != NULL) ; |
There was a problem hiding this comment.
From my reading of this, it seems like some of these changes might not be meaningful (though I'm sure there's something in this PR that's fixing the underlying bug)
Since plist is set to panda_cbs[PANDA_CB_INSN_EXEC] I don't see how plist could ever be NULL while the panda_cbs[PANDA_CB_INSN_EXEC] object is non-NULL - since they're the same.
Though, if there are multiple threads causing race conditions, then that could mean timing is changed by the redundant check (if it's not optimized out) and perhaps improve things - though at that point I'd think the solution would be to do better thread safety instead of duplicating checks.
There was a problem hiding this comment.
Hang on - staring at this closer and seeing how they could differ - after the initial iteration of the loop the panda_cb_next updates plist and perhaps after the first iteration the entire list could become NULL?
Seems like an easier fix might be to ensure the various callback lists only ever become empty, not null?
This PR fixes #1527 by adding checks to see if the list is empty on each iteration.
FIXES: #1527