Skip to content
Snippets Groups Projects

Bugfix: Don't use DECLARE_TYPE() with NULL dealloc

Merged Fredrik Roubert requested to merge roubert/pyicu:dealloc into main

Using a NULL dealloc will result in calling the wrong destructor, the base class destructor (which isn't virtual) instead of the actual one.

In the ICU4C default configuration (U_OVERRIDE_CXX_ALLOCATION=1) this isn't immediately noticeable as the operator delete implementation there simply calls uprv_free() without caring about what is being deleted, but other implementations (U_OVERRIDE_CXX_ALLOCATION=0) aren't always as cavalier about this.

To resolve this, a new macro that declares a type appropriate dealloc is introduced and used to replace DECLARE_TYPE() with NULL dealloc for all ICU4C types with public destructors.

Tested using U_OVERRIDE_CXX_ALLOCATION=0 and TCMalloc.

Merge request reports

Merged by Andi VajdaAndi Vajda 1 year ago (Dec 22, 2023 12:47pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading