zoukankan      html  css  js  c++  java
  • How WindowLeaked exception occured?

    If a Activity performDestroy, and there is window not closed whose window token is the Activity's mWindow, WindowLeaked exception will occur.

    Especially, app adds a view to WindowManager, when the app come across a crash, and if the app not remove the view from WindowManager at Activity's onDestory() callback funtion, the WindowLeaked exception occurs.

    When an app come across an exception, the activity will performStop() first, in this function, will callback mWindow's closeAllPanels() which will close all menus window. And then, activity will performDestory(), in this function will call WindowManagerGlobal's closeAll() function, if there is any window associate with the activity's mWindow, close it and report a WindowLeak.

    So, to avoid this. You should make sure to remove all views added to WindowManager before the activity be destroyed.

    By the way, WindowManager's removeView() and removeViewImmediate is different. The later will cause a immediate remove.

  • 相关阅读:
    .NET 异步详解
    spring batch简介
    Nginx 配置文件介绍
    局域网内组播
    qt自定义信号函数的那些坑
    传输文件到远程服务器
    vim复制指定行
    腾讯云获取公网ip
    ifconfig添加或删除ip
    程序中tar压缩文件
  • 原文地址:https://www.cnblogs.com/haobo/p/3844547.html
Copyright © 2011-2022 走看看