I've been trying to figure this one out for a while so sorry if I sound 
frustrated...

>From my javascript code I have the following:
this.props().appViewModel.currentUser().data.*createUserCheckinAsync*(this.
currentBusiness().data, null);
this.currentBusiness().data.*readProductsAsync*(0, 20, "");

Which eventually calls into the following C++ code:
    void Business::*readProductsAsync*(unsigned int index, unsigned int 
count, std::string name)
    {
     printf("readProductsAsync - entered\n");
     printf("readProductsAsync - attempting shared_from_this\n");
     this->*shared_from_this*();
     ...


Which eventually compiles out (with -O0 and -g4) to
 (_printf(91357,$vararg_buffer)|0); //@line 134 
"C:\Users\ricky\Documents\Projects\SCI.Ranking.Client.Engine\ViewModel\Business.cpp"
 (_printf(91386,$vararg_buffer1)|0); //@line 135 
"C:\Users\ricky\Documents\Projects\SCI.Ranking.Client.Engine\ViewModel\Business.cpp"
 $15 = ((($14)) + 4|0); //@line 136 
"C:\Users\ricky\Documents\Projects\SCI.Ranking.Client.Engine\ViewModel\Business.cpp"
 __ZNSt3__123enable_shared_from_thisIN9threadily12ThreadObjectEE16
*shared_from_this*Ev($3,$15); //@line 136 
"C:\Users\ricky\Documents\Projects\SCI.Ranking.Client.Engine\ViewModel\Business.cpp"

When it actually attempts to run the this->shared_from_this() I get a 
failure which is just gibberish to me
Compiled code throwing an exception, 5489120,17072,2523
can_catch on 5489120
Resuming exception 5489120,5489120

Here's the kicker... In that first block of code, if I comment out the line 
to execute *createUserCheckingAsync* and only run *readProductsAsync*, 
everything works fine and there are no exceptions. So the next question 
would be what's in createUserCheckinAsync? Well I managed to clean out all 
the code until it looks like this...

    void User::createUserCheckinAsync(std::shared_ptr<Business> business, 
std::shared_ptr<Product> product)
    {
     this->isUserCheckinPending->set(true);
     this->isUserCheckinPending->set(false);
     return;
    }

I guess my questions here are:
1. Why would a call to createUserCheckinAsync interfere with the call to 
readProductsAsync? There are no objects being destroyed between the two... 
so I'm not sure what the difference is.
2. Why would this->shared_from_this ever throw an exception?

Now just as a sanity check, I did create a Visual Studio C++ Unit test and 
this same scenario succeeds... So the only thing I can think of is attempt 
to rewrite the tests in clang and see if they fail there.

Anyways, any help is massively appreciated in figuring out how to debug 
this issue! Is it possibly a corruption of the stack that doesn't show up 
in MSBuild?

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to