Skip to content

Commit d3faf1a

Browse files
committed
Initalize mock callbacks earlier
Avoid use after static destruction in sycl unittests by moving the initialization of `mock::callbacks` from static function scope to static global scope.
1 parent 4f2ce7f commit d3faf1a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

source/mock/ur_mock_helpers.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
#include "ur_mock_helpers.hpp"
1414

1515
namespace mock {
16+
static callbacks_t callbacks = {};
1617

17-
callbacks_t &getCallbacks() {
18-
static callbacks_t callbacks;
19-
return callbacks;
20-
}
18+
callbacks_t &getCallbacks() { return callbacks; }
2119

2220
} // namespace mock

0 commit comments

Comments
 (0)