You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
leak could still occur when used like bellow:
WeakHandler handler = new WeakHandler();
Message m = Message.obtain(handler.getExecHandler(), new Runnable() { @OverRide
public void run() {
//do something
}
});
handler.sendMessageDelayed(m, delaytimes);
although postDelay() should be used here, but what if when we get message like this:
Message message = Message.obtain(m);
and m has a callback?
so maybe sendMessageXX() methods should be optimized:
public final boolean sendMessage(Message msg) {
if (msg.getCallback() != null) {
return mExec.post(msg.getCallback());
}
return mExec.sendMessage(msg);
}
public final boolean sendMessageAtFrontOfQueue(Message msg) {
if (msg.getCallback() != null) {
return postAtFrontOfQueue(msg.getCallback());
}
return mExec.sendMessageAtFrontOfQueue(msg);
}
public boolean sendMessageAtTime(Message msg, long uptimeMillis) {
if (msg.getCallback() != null) {
return postDelayed(msg.getCallback(), uptimeMillis);
}
return mExec.sendMessageAtTime(msg, uptimeMillis);
}
public final boolean sendMessageDelayed(Message msg, long delayMillis) {
if (msg.getCallback() != null) {
return postDelayed(msg.getCallback(), delayMillis);
}
return mExec.sendMessageDelayed(msg, delayMillis);
}
The text was updated successfully, but these errors were encountered:
leak could still occur when used like bellow:
WeakHandler handler = new WeakHandler();
Message m = Message.obtain(handler.getExecHandler(), new Runnable() {
@OverRide
public void run() {
//do something
}
});
handler.sendMessageDelayed(m, delaytimes);
although postDelay() should be used here, but what if when we get message like this:
Message message = Message.obtain(m);
and m has a callback?
so maybe sendMessageXX() methods should be optimized:
The text was updated successfully, but these errors were encountered: