Skip to content

Conversation

wcandillon
Copy link
Contributor

fixes #3365

@wcandillon wcandillon requested a review from Copilot September 12, 2025 07:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a memory error in animated Box shadows by optimizing the way shadow objects are created and stored in the vector. The fix addresses issue #3365 by eliminating unnecessary object copying during shadow processing.

  • Replaces push_back with emplace_back to construct shadow objects directly in the vector
  • Uses a reference to the emplaced object to avoid creating temporary objects
  • Removes an unnecessary comment line

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +389 to +391
// Create shadow directly in vector to avoid copy
shadows.emplace_back();
BoxShadowCmdProps &shadow = shadows.back();
Copy link
Preview

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions avoiding copy, but this approach still creates a default-constructed object then modifies it. Consider using emplace_back with direct initialization of the struct members to truly avoid intermediate object creation.

Copilot uses AI. Check for mistakes.

@wcandillon wcandillon merged commit a687455 into main Sep 12, 2025
12 of 13 checks passed
Copy link
Contributor

🎉 This PR is included in version 2.2.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does BoxShadow's dx / dy props no longer support animated values?
1 participant