Oops, sorry...  It's asynchronous, so my list object is most probably
always null when I read it.

What is strange is why it's not null in development mode

Is runAsync running synchronously in dev mode ?

On 14 jan, 13:29, mably <[email protected]> wrote:
> Hi everybody,
>
> I have some GWT 2.0 runAsync code that works perfectly fine in dev
> mode but fails in normal mode.
>
> Is it a GWT bug or am I doing something wrong ?
>
> Is there some way to identify where the probleme comes from exactly ?
>
> The only information I have is a Chrome Developer Tools javascript
> error that says : "Uncaught TypeError: Cannot call method 'Lc' of
> null".  And nothing in Eclipse while running in dev mode.
>
> Here is my java code using runAsync :
>
> public class GwtListHelper {
>
>         private Map<String, GwtList> lists = new HashMap<String, GwtList>();
>
>         public GwtList getList(String type) {
>                 GwtList list = lists.get(type);
>                 if (list == null) {
>                         ListWrapper lw = new ListWrapper();
>                         getListAsync(type, lw);
>                         list = lw.getList();
>                         lists.put(type, list);
>                 }
>                 return list;
>         }
>
>         private void getListAsync(final String type, final ListWrapper lw) {
>                 if ("user".equals(type)) {
>                         GWT.runAsync(new RunAsyncCallback() {
>                                 public void onSuccess() {
>                                         lw.setList(new UserList());
>                                 }
>                                 public void onFailure(Throwable reason) {
>                                         Window.alert(type + " list not loaded 
> !");
>                                 }
>                         });
>                 }
>         }
>
>         private class ListWrapper {
>                 GwtList list;
>                 public void setList(GwtList list) {
>                         this.list = list;
>                 }
>                 public GwtList getList() {
>                         return this.list;
>                 }
>         }
>
>
>
> }
-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to