[0171] 修复 Qt SVG 图标加载中的内存泄漏#3528
Open
da-liii wants to merge 2 commits into
Open
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
在 qt_load_svg_icon 函数中,new QImage 分配的临时图像在转换为 QPixmap 后未释放,导致每次加载 SVG 图标都会泄漏内存。在 return 前添加 delete pm 修复此问题。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
修复
qt_load_svg_icon函数中的内存泄漏问题。问题描述
在
src/Plugins/Qt/qt_picture.cpp的qt_load_svg_icon函数中,加载 SVG 图标时通过new QImage分配了一个临时QImage对象用于渲染,但在将图像转换为QPixmap并返回之前,没有释放该临时对象,导致每次加载 SVG 图标都会泄漏内存。修复方式
在
return icon;之前添加delete pm;语句,释放临时分配的QImage。测试
🤖 Generated with Claude Code