Skip to content

Remove undefined behavior from QMessageLogContext#1399

Open
jnbooth wants to merge 1 commit intoKDAB:mainfrom
jnbooth:remove-logging-undefined-behavior
Open

Remove undefined behavior from QMessageLogContext#1399
jnbooth wants to merge 1 commit intoKDAB:mainfrom
jnbooth:remove-logging-undefined-behavior

Conversation

@jnbooth
Copy link
Contributor

@jnbooth jnbooth commented Jan 28, 2026

According to the safety documentation for CStr::from_ptr, the pointer must be non-null. Currently, the functions for QMessageLogContext do not check for null pointers. This PR adds those checks, removing the undefined behavior.

Note: cxx-qt-lib's qtlogging code is noticeably messy. In addition to the above undefined behavior, it has extraneous unsafe specifiers and a pointless const assertion that was probably supposed to occur on the C++ side, and its functions are in the global namespace rather than rust::cxxqtlib1. It also solely exposes undocumented internal functionality and doesn't respect category disabling. I made #1398 to serve as an alternative for it.

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (55106f0) to head (771fd43).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1399   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           75        75           
  Lines        13124     13124           
=========================================
  Hits         13124     13124           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant