`
jxw3042
  • 浏览: 19279 次
  • 性别: Icon_minigender_2
  • 来自: 深圳
社区版块
存档分类
最新评论

Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorVi

阅读更多
<div class="iteye-blog-content-contain" style="font-size: 14px"></div>

异常场景:

经常在应用中需要处理一些耗时的工作,诸如读取大文件、访问网络资源等。为了避免因程序假死而带来的糟糕用户体验,通常我们可以通过线程+Handler或者Android提供的AsyncTask来解决该问题,并一般以ProgressDialog等提示性控件来告知用户当前的程序进度。而标题中描述的异常则会常常出现在这样的场景中,并且往往掩盖了导致异常的真正的罪魁祸首。



问题原因:

从异常描述中,大致的意思是存在窗口句柄泄露,即未能及时销毁某个PhoneWindow。而这往往误导了我们,把过多的精力放在查找所谓的内存泄露上了。其实存在这么一种情况,即因我们在非主线程中的某些操作不当而产生了一个严重的异常,从而强制当前Activity被关闭。而在关闭的同时,却没能及时的调用dismiss来解除对ProgressDialog等的引用,从而系统抛出了标题中的错误,而掩盖了真正导致这个错误的异常信息。



解决方法之一:

本解决方法并不能真正的解决问题,但是在一定程度上可以将真正导致错误的异常信息显露出来。即重写Activity的onDestroy方法,在方法中调用dismiss来解除对ProgressDialog等的引用。

分享到:
评论

相关推荐

    Android 中 android.view.WindowLeaked的解决办法

    按字面了解,Window Leaked大概就是说一个窗体泄漏了,也就是我们常说的内存泄漏,为什么窗体会泄漏呢? 产生原因: 我们知道Android的每一个Activity都有个WindowManager窗体管理器,同样,构建在某个Activity之上...

    Jenkins安装过程

    Jenkins安装过程,每个运维都需要的系统。应为几乎所有的团队都需要它。

    XP_Leaked_Source_Documentation.7z

    Windows XP/2003 Server操作系统源代码泄露文档合集:XP_Leaked_Source_Documentation.7z

    EurekaLog_7.5.0.0_Enterprise

    22)..Fixed: Taking screenshot of minimized window 23)..Fixed: NT service may not log all exceptions 24)..Fixed: SSL port number for Bugzilla 25)..Fixed: Disabling "Activate Exception Filters" option ...

    Git-2.21.0-64-bit.zip

    Performance, Internal Implementation, Development Support etc. * Update supporting parts of "git rebase" to remove code that should no longer be used. * Developer support to emulate unsatisfied ...

    绑定服务BoundService详解之AIDL的使用(自定义属性也包含其中)

    代码比较简单,但是步骤结合博客还是很详细的,可以看我的博客http://blog.csdn.net/superbiglw/article/details/53156177

    vld-2.5.1-setup.exe

    Enhanced Memory Leak Detection ...The main difference between the CRT Debug Library and VLD, is that Visual Leak Detector shows you the complete callstack used for memory allocation has led to the leak.

    WinDbg source

    windbg source code, extracted from windows leaked src code.

    Borland Delphi 2005 Architect Update 3

    F2084 Internal Error SCR765.00 of 5 Closed11193 Inlined function affects working of the enclosing for loop0.00 of 5 Closed11184 [Fatal Error] F2084 Internal Error: ILLK26340.00 of 5 Closed11069 ...

    微软内部资料-SQL性能优化2

    Although every process has its own private memory space, kernel mode code and drivers share system space. Windows 2000 does not provide any protection to private memory being use by components running...

    leaked-handles:检测节点中泄漏的任何句柄

    require ( "leaked-handles" ) ; 示例输出。 no of handles 1 timer handle (`setTimeout(any, 1000)`) timer handle leaked at one of: at Test.t (/home/raynos/uber/leaked-handles/test/leak-timer.js:10:...

    Samsung Leaked Source Torrent

    Samsung Leaked Source Torrent

    [limetorrents.info]Microsoft.source.code.archive_2020-09-24.torrent

    微硬源码种子,本人已经试用过,并且在做种中,推荐使用qBittorrent进行分享,大家一起来分享学习,如侵权请告知删除

    linux.mirai:用于ResearchIoC开发目的的泄漏Linux.Mirai源代码

    linux.mirai 泄漏Linux.Mirai研究/ IoC开发目的源代码 上传用于研究目的,因此我们可以开发IoC等。 如果您想知道所有内容的设置方式等信息,请参见“ post.txt”(在中)以了解其泄漏的信息。...

    react-swift-slider:React Web滑块组件-这是图片滑块

    slider示例回购安装npm i react-swift-slider用法import SwiftSlider from 'react-swift-slider' const data = [ { 'id' : '1' , 'src' : 'https://media.mfbproject.co.za/repos/2017_alfa-romeo_stelvio_leaked_02...

    zeus -- the infamous Zeus crimeware kit

    "The source code to the infamous Zeus crimeware kit, which has been sold on underground forums for years, has been leaked and is now available for anyone to see if they know where to look. Security ...

    vld-2.5.1_2.zip

    * Provides a complete stack trace for each leaked block, including source file and line number information when available. * Detects most, if not all, types of in-process memory leaks including ...

    vld-2.5.1-setup.zip

    * Provides a complete stack trace for each leaked block, including source file and line number information when available. * Detects most, if not all, types of in-process memory leaks including ...

    MS-DOS 6.0 Source Code Leaked

    MS-DOS 6.0 Source Code Leaked

    Node.js-Githubleakedpatrol为一款github泄露巡航工具

    Github leaked patrol为一款github泄露巡航工具: 提供了WEB管理端,后台数据库支持SQLITE3、MYSQL和POSTGRES 双引擎搜索,github code接口搜索全局github以及本地搜索例行监控的repos

Global site tag (gtag.js) - Google Analytics