关于Qt solution中qtwinmigrate framework的一个bug
2009-12-28 15:33
651 查看
版权声明
请尊重原创作品。转载请保持文章完整性,并以超链接形式注明原始作者“tingsking18”和主站点地址,方便其他朋友提问和指正。在国外的一个论坛上找到的:
The WinMigration framework does the following behind the scenes when you
call QMfcApp::pluginInstance in your DllMain function for the ATTACH-case:
If qApp is still 0, then create a QApplication object, and load the DLL
again (based in the HINSTANCE parameter you pass in). This increase the
reference count of the DLL that owns the QApplication object - the DLL will
not be unloaded even if the application that explicitly loaded the DLL as a
plugin calls FreeLibrary (unless the application calls FreeLibrary more
often that it called LoadLibray, which is of course a bug in the
application).
Other DLLs loaded later will see that qApp already exists, and just share
that instance. Those DLLs will be unloaded by the application when it calls
FreeLibrary.
The DLL owning qApp will then be unloaded by the system when the process
exits. In that case, DllMain with DETACH will be called, and you can delete
qApp in your code (based on the return value of the call to pluginInstance
earlier).
All this should also work if you link against those DLLs rather than
LoadLibrary/FreeLibrary them yourself, as the system will free the DLLs
loaded during application startup in the opposite order of which they were
loaded.
相关文章推荐
- .NET framework 一个关于OleDbParameters的Bug
- 关于ios横竖屏显示不正常的一个Bug修复
- 在ASP.NET中,发现的关于string转换的一个小Bug
- java web start关于初始堆大小的一个有意思的bug
- MySQL关于exists的一个bug
- WPF关于WindowInteropHelper的一个BUG
- 一个关于C#语言中的Property的低级BUG,花了我二十分钟
- [lwn] A nasty file corruption bug - fixed (关于Linus解决的一个set_page_dirty很隐蔽的bug)
- WinSock中关于阻塞接收/发送超时的一个BUG
- 关于storm0.10.0版本的一个小bug
- 关于long_query_time的设置,可不可以说是mysql的一个小小bug呢
- 关于Ext.form.NumberField中输入一个超大数字,失去焦点后变成另一个数字的bug的处理
- 关于一个时间间隔bug的来源
- 一个关于临时对象的BUG(下)
- 关于缓冲区的一个BUG
- 关于Qt开发中的一个痛的领悟
- 最近写出一个bug,关于模块在注册时返回-1
- 关于Qt编译时问题的一个非常奇怪的解决方法
- 关于qt绘制图形中的一个极易出错的点
- Java中关于 BigDecimal 的一个导致double精度损失的"bug"