summaryrefslogtreecommitdiff
path: root/core/error
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-09 14:18:53 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-09 14:18:53 +0100
commitd46568205de9dcc5bb8367644c5b2f00986b0761 (patch)
tree2c292e22ed1679738908b98d16cd99583dc86723 /core/error
parent4a504e3181c0b6d8ccc19a83452d1639c305b83a (diff)
parentb1c7665866717248a2d90ac8908acb9998da014a (diff)
Merge pull request #64795 from RandomShaper/fix_saferefcount
Prevent misuse of SafeRefCount
Diffstat (limited to 'core/error')
-rw-r--r--core/error/error_macros.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/error/error_macros.h b/core/error/error_macros.h
index f651ef57a3..63a2d22416 100644
--- a/core/error/error_macros.h
+++ b/core/error/error_macros.h
@@ -33,7 +33,7 @@
#include "core/typedefs.h"
-#include "core/templates/safe_refcount.h"
+#include <atomic> // We'd normally use safe_refcount.h, but that would cause circular includes.
class String;
@@ -737,10 +737,10 @@ void _err_flush_stdout();
*/
#define WARN_DEPRECATED \
if (true) { \
- static SafeFlag warning_shown; \
- if (!warning_shown.is_set()) { \
+ static std::atomic<bool> warning_shown; \
+ if (!warning_shown.load()) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", false, ERR_HANDLER_WARNING); \
- warning_shown.set(); \
+ warning_shown.store(true); \
} \
} else \
((void)0)
@@ -750,10 +750,10 @@ void _err_flush_stdout();
*/
#define WARN_DEPRECATED_MSG(m_msg) \
if (true) { \
- static SafeFlag warning_shown; \
- if (!warning_shown.is_set()) { \
+ static std::atomic<bool> warning_shown; \
+ if (!warning_shown.load()) { \
_err_print_error(FUNCTION_STR, __FILE__, __LINE__, "This method has been deprecated and will be removed in the future.", m_msg, false, ERR_HANDLER_WARNING); \
- warning_shown.set(); \
+ warning_shown.store(true); \
} \
} else \
((void)0)