[aquaria] I recommend to use this fix

Mathias Panzenböck grosser.meister.morti at gmx.net
Tue Apr 26 22:16:47 EDT 2011


Ok, now I have implemented a third version of a fix:
Now IngredientData instances are not copyable and there is one dedicated owner (the class 
Continuity, holding the ingredients in ingredientData). I also did some cleanup on the FoodHolder 
code (reduced redundancy of changes to amount and held etc., and use FoodHolder::discard() where its 
code was duplicated).

I created 3 branches in my bitbucket repo for the 3 versions of the fix. Please pull the one you 
think is the best. I think it should be panzi-non-copyable-ingredient-data.

panzi-non-copyable-ingredient-data:
current: https://bitbucket.org/panzi/aquaria/changeset/ebc8ac17a1c8
start:   https://bitbucket.org/panzi/aquaria/changeset/873470bacd94

panzi-ingredient-data-by-name:
current: https://bitbucket.org/panzi/aquaria/changeset/7a48985b2678
start:   https://bitbucket.org/panzi/aquaria/changeset/853c6b8c7361

panzi-ingredient-data-smartptr:
current: https://bitbucket.org/panzi/aquaria/changeset/7d8aeb2698c3
start:   https://bitbucket.org/panzi/aquaria/changeset/ab7869354c17

Repo URL:
https://bitbucket.org/panzi/aquaria

The changes in panzi-non-copyable-ingredient-data are attached as a patch.

	-panzi

On 04/26/2011 07:03 PM, Andrew Church wrote:
>> So all IngrediantData* fields should be replaced with std::string fields?
>
> With respect to the food holders, yes.  (I don't want to comment on other
> uses of IngredientData at the moment since I haven't checked them in
> detail.)  Then you'd have a lookup call in each function that currently
> dereferences the stored pointer.
>
>> When I cook something else and then combine two leaves twice I couldn't reproduce the crash myself.
>> I guess I have found a certain inventory state that shows this behaviour by accident. I attached the
>> save state that causes the problem. Just immediately open the cooking menu and combine two leaves twice.
>
> Thanks!  I confirmed the crash here -- it looks like the cause in this
> case is that the first action on the inventory is cooking a new item,
> which causes the push_back() call to expand (and thus reallocate) the
> inventory array.
>
>    --Andrew Church
>      achurch at achurch.org
>      http://achurch.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aquaria-non-copyable-ingrediant-data.patch
Type: text/x-patch
Size: 24577 bytes
Desc: not available
URL: <http://icculus.org/pipermail/aquaria/attachments/20110427/4b0d3c33/attachment.bin>


More information about the aquaria mailing list