Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1972] click event inside tableview click event causes exception

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-18T23:10:14.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0
ComponentsAndroid
Labelsandroid, defect, emulator
ReporterPaul Dowsett
AssigneeDon Thorp
Created2011-04-15T03:06:56.000+0000
Updated2011-04-18T23:10:14.000+0000

Description

Adding a click event inside another click event causes an exception.

I have just found this bug in the latest build, 1.4.2 / 30.09.2010. The 1.4.2 CI build released 21.09.2010 did not have this issue.

To see the issue in action, replace Resources/examples/animation.js in the KitchenSink with the following code:

http://gist.github.com/605647">Resources/examples/animation.js

Here is the error output:

2087           KrollContext  D  (kroll$4) [550,44126] eval file: app://examples/animation.js
2087               dalvikvm  D  GC_FOR_MALLOC freed 4800 objects / 266512 bytes in 124ms
60     InputManagerService  W  Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44fc6370
60     InputManagerService  W  Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44fa11c0
2087          KrollCallback  E  (kroll$4) [23525,67651] Error evaluating source: Wrapped java.lang.NullPointerException (app://examples/animation.js#40)
2087          KrollCallback  E  org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (app://examples/animation.js#40)
2087          KrollCallback  E      at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Unknown Source)
2087          KrollCallback  E      at org.appcelerator.titanium.kroll.KrollMethod.call(KrollMethod.java:96)
2087          KrollCallback  E      at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
2087          KrollCallback  E      at script(app://examples/animation.js:40)
2087          KrollCallback  E      at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
2087          KrollCallback  E      at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
2087          KrollCallback  E      at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
2087          KrollCallback  E      at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
2087          KrollCallback  E      at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
2087          KrollCallback  E      at org.appcelerator.titanium.kroll.KrollCallback$1.run(KrollCallback.java:70)
2087          KrollCallback  E      at android.os.Handler.handleCallback(Handler.java:587)
2087          KrollCallback  E      at android.os.Handler.dispatchMessage(Handler.java:92)
2087          KrollCallback  E      at android.os.Looper.loop(Looper.java:123)
2087          KrollCallback  E      at android.os.HandlerThread.run(HandlerThread.java:60)
2087          KrollCallback  E  Caused by: java.lang.NullPointerException
2087          KrollCallback  E      at org.appcelerator.titanium.proxy.TiViewProxy.setClickable(TiViewProxy.java:589)
2087          KrollCallback  E      at org.appcelerator.titanium.proxy.TiViewProxy.eventListenerAdded(TiViewProxy.java:569)
2087          KrollCallback  E      at org.appcelerator.titanium.TiContext.dispatchOnEventChange(TiContext.java:362)
2087          KrollCallback  E      at org.appcelerator.titanium.TiContext.addEventListener(TiContext.java:409)
2087          KrollCallback  E      at org.appcelerator.titanium.TiProxy.addEventListener(TiProxy.java:232)
2087          KrollCallback  E      at java.lang.reflect.Method.invokeNative(Native Method)
2087          KrollCallback  E      at java.lang.reflect.Method.invoke(Method.java:521)
2087          KrollCallback  E      at org.appcelerator.titanium.kroll.KrollMethod.call(KrollMethod.java:84)
2087          KrollCallback  E      ... 11 more

Comments

  1. hal 2011-04-15

    Oh I forgot to mention what will result when running the usecase code:

    In KS, open the BaseUI tab, click Animation, then click Basic (or any of the table rows), and an exception will result before showing the alert dialog

  2. Don Thorp 2011-04-15

    (from [25b72fafef8cfa461ae2f4d3b2c6d844e9c9f2a6]) [#1972 state:fixed-in-qa] Assumed the nativeView was set and shouldn't have. http://github.com/appcelerator/titanium_mobile/commit/25b72fafef8cfa461ae2f4d3b2c6d844e9c9f2a6"> http://github.com/appcelerator/titanium_mobile/commit/25b72fafef8cf...

  3. hal 2011-04-15

    Don
    I can confirm that this resolved the problems I was having.
    Thanks for fixing so quickly!
    Hal

  4. Thomas Huelbert 2011-04-15

    1.4.2.4ce7ff G1 running 1.6, 2.2 simulator

JSON Source