Commit 513ba95
committed
fix: remove redundant setParent call in NetItemPrivate
The code was calling setParent on the newly created NetItem object with
its private implementation as the parent. This is unnecessary and likely
incorrect since the private implementation is not a QObject. The parent-
child relationship in Qt should be between QObjects, and NetItemPrivate
is not a QObject subclass. This was causing compilation errors due to
type mismatch in the setParent call.
The fix removes the redundant setParent call which was attempting to
set a non-QObject as parent. The NetItem object should manage its own
parent relationships separately if needed, not through its private
implementation class.
Influence:
1. Verify that NetItem objects are still properly created and
initialized
2. Test that parent-child relationships work correctly when NetItem
objects need them
3. Ensure no memory leaks occur due to missing parent relationships
4. Test that all NetItem subclasses (NetType, etc.) compile and work
correctly
fix: 移除NetItemPrivate中冗余的setParent调用
代码在新建NetItem对象时尝试将其父对象设置为私有实现类,这是不必要且错误
的,因为私有实现类不是QObject。Qt中的父子关系应该存在于QObject之间,而
NetItemPrivate不是QObject的子类。这导致了setParent调用中的类型不匹配编译
错误。
修复移除了冗余的setParent调用,该调用试图将非QObject对象设置为父对象。
NetItem对象如果需要父子关系,应该单独管理,而不是通过其私有实现类。
Influence:
1. 验证NetItem对象仍能正确创建和初始化
2. 测试当NetItem对象需要父子关系时,这些关系能正常工作
3. 确保不会因缺少父子关系而导致内存泄漏
4. 测试所有NetItem子类(NetType等)都能正确编译和工作1 parent d5e89e0 commit 513ba95
1 file changed
+0
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
| |||
0 commit comments