Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QApplication在析构时会引起DPlatformIntegration的析构,DPlatformIntegration析构会释放其静态成员变量m_xsettings。 DGuiApplicationHelper为全局变量,只会init一次,创建DPlatformTheme, DPlatformIntegration::buildNativeSettings在new DNativeSettings时会拷贝DPlatformIntegration的m_xsettings变量, 保存在其成员变量m_settings里。 当QApplication第二次构造时,重新获取调色板,会通过DGuiApplicationHelper访问应用主题, 继而会访问到DNativeSettings指向的m_settings成员变量, 此时m_settings指向的内存已经在上一次QApplication析构时释放掉了,成为了野指针,导致程序崩溃。 在QApplication析构之后再将DGuiApplicationHelper析构, 需要时再重新构造DGuiApplicationHelper,再次init,创建DPlatformTheme, 可保证DNativeSettings跟QApplication实例化次数无关,每次都重新构造。 Log: Change-Id: I1aaba6397124afb3b95cc46c82db0efb2999a9aa
- Loading branch information