derrell / App-Inventor-Gallery

App Inventor Gallery
20 stars 17 forks source link

MApps.getAppInfo() incorrectly writes data #37

Closed reedspool closed 13 years ago

reedspool commented 13 years ago

MApps.getAppInfo() is a read-only function as far as the database is concerned. It does however return a formatted App object, instead of the original. At the moment, when one opens an App Info page, by clicking on an App in the gallery, everything looks great. By closing the new App Info Tab, and clicking on the very same App in the gallery again, an error is drawn. The error is from MApps.getAppInfo() trying to retrieve the App from the database, but instead getting the formatted App object it received previously.

reedspool commented 13 years ago

Attempted a quick-fix given by Darrell: for getAppInfo() to make copies of the results before issuing them. I used a Json.stringify and then Json.parse to accomplish this. It did not succeed, the bug persists. Somewhere, there is a write that should not be writing. It is worth noting that Mary said she got this error on the Emulator as well!

derrell commented 13 years ago

@reedspool @mbenn112

There must have been a recent change in getAppInfo() that suddenly exercised this bug. The problem is that a deep copy must be made of query results, when using the simulator, so that changes to the results don't affect the simulated database. That was being done in the case of a "normal" query with constraints, but when a query was issued that provided the explicit key of the object to retrieve, the actual object from the database was returned, not a clone of that object.

derrell commented 13 years ago

Fixed with qooxdoo-contrib r21295.