Jump to content

Occasional error soon after loading page


mwatt
 Share

Recommended Posts

Hi Mat,

 

I'm very thankful that you are willing to consider looking into this, but I don't quite know how to move forward.  It's happening in a fairly large project and only occasionally at that.  I don't know how to reproduce it at will nor how to make it happen with a small test case.  I can say in general that I am using several Graphical objects, a small number of Text objects and just one sprite and that sprite would have been created, but not really manipulated before this error occurs.  I am also using scaling and I am centering to boot.  I use a container object for the scaling of course.

 

I'll be on the lookout for any other information I can garner and let you know.  I would be willing to share the source with you but I really don't think you'd want to plow through all of it - I know I wouldn't. :)

 

If any thoughts or wild guesses come to you about possible reasons this might occur, please do share.

 

Regardless, I'd like to close by thanking you not only for Pixi but also for your supportiveness.  I'm grateful for this board as well, and of course for all that Rich does.

Link to comment
Share on other sites

...

 

I'll be on the lookout for any other information I can garner and let you know.  I would be willing to share the source with you but I really don't think you'd want to plow through all of it - I know I wouldn't. :)

 

If any thoughts or wild guesses come to you about possible reasons this might occur, please do share.

...

 

Hmm ... this is just a wild guess  ;) :

 

Do you use the method getLocalPosition of the interaction data somewhere?

 

If so, could it be - that the argument you pass to this function is null at the time (when you call this method)?

 

At least, I got the same error message, when calling the function with a null argument.

 

Well, just a guess.

Link to comment
Share on other sites

Thanks for the wild guesses. :)

 

@benny!: Nope, not making that particular call, but the suggestion is very much appreciated.

 

@rich: It's interesting that you ask about checking on module loading - I only recently put in a mechanism to do this.  For an issue with a module loading problem on the iPad I instigated a system where modules report when they are finished loading and a function on an incremental timer periodically checks that the expected number are loaded (and only then does true app initialization commence).  That didn't solve my iPad issue but perhaps it will solve this error issue - that remains to be seen. I will say though, that in a desktop browser my modules all appear to be loading well before this error occurs, when it does occur.   The error happens about 5 seconds in and module loading apparently completes in under 1 second.  However, again interesting - you bring up the async idea.  I do have a couple of animation delay timers and one of them fires at right around 5 seconds.  I'll investigate.

 

Thanks again to the both of you.  If either of you or anyone else have any further ideas, please do post them.

Link to comment
Share on other sites

@mrwatt:

Hmm ... strange. Does it give you the line number which throws that error? Maybe you could track down the origin of this error from there?

Btw, what Pixi.js version are you using? Did you try it with another version ?

 

Good luck.

 

Best,

benny!

Link to comment
Share on other sites

Unfortunately, I'll have to wait for it to occur again in order to answer your questions about tracking it down to a specific location in the source.  The version of Pixi.js I am using is v1.3.0, compiled on 2013-09-28.

 

One thing I was doing that I have stopped doing within the approximate timeframe that this error would sometimes occur (and maybe this will help) is that I was rapidly creating approximately 50 Pixi Point objects.  I didn't really need Pixi Objects so I substituted with my own Point class.  Time will tell.

Link to comment
Share on other sites

Well, as luck would have it, the error just occurred again, and for some reason it now happens almost every time - but only in Crome and only upon first load.  If refresh it does not seem to happen.

 

It happened at this line in the PIXI.DisplayObject.prototype.updateTransform function:

var parentTransform = this.parent.worldTransform;

 

The error is to the effect that this.parent is null.  It is making me think that I am possibly trying to render something that never did have, or no longer has a parent...

 

I'll be looking into it more now that it is at least semi-reproduce-able.  I am doing some animating and clearing in between animation steps.  I wonder if this could be related to Chrome's clear rect problem that I have been hearing about

Link to comment
Share on other sites

Hi guys!

 

This may be an issue that exists when removing an element during its update transform? 

--> https://github.com/GoodBoyDigital/pixi.js/issues/235

Might shed some light?

 

@mwatt, no worries regarding pixi support - I am very passionate about all this stuff and always keen to help :) If only there where more hours in the day! And yes, nice one Rich on providing a platform too :D

Link to comment
Share on other sites

It turns out that the "this" object that is causing the error has a good reason to have a null parent - the object that blows here is the stage.

 

I wonder what I could possibly be doing wrong to have the stage be an object that gets processed through update transform?  The only thing I can think of is that I might erroneously be assigning the stage to be a child of something.  I'll have to look into that.  I welcome other ideas and comments.

Link to comment
Share on other sites

I've refactored my code but still haven't licked this.

 

Is there a "right" time and a "wrong" time to remove content from a DisplayObjectContainer and subsequently remove this display object container from the stage?

 

Note: I am using the following function twice, consecutively, to do the stuff I described above.  The first time the "container" is the scene DisplayObjectContainer.  The second time the container is the stage.

 

var removeAllChildren = function (container) {

  for (var i = container.children.length - 1; i >= 0; i--) {

    container.removeChild(container.children);

  }

};

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...