[aquaria] crash :/

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


Ok, this would be a patch that replaces all IngredientData* with std::string. I hope I do the lookup 
of the IngredientData objects right. After all there are two places where IngredientData instances 
can be for some reason.

Are the IngredientData objects supposed to be copyable? Shouldn't these be global objects 
initialized on startup and freed on shutdown? If yes I would write yet another patch that _would_ 
use IngredientData* everywhere, even in all lists that are currently std::vector<IngredientData>. I 
would then add a list where the instances are held (the real owner of the objects) and ensure that 
this list isn't manipulated in a wrong way (only adding of entries and only clear+free on shutdow).

	-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/
> _______________________________________________
> aquaria mailing list
> aquaria at icculus.org
> http://icculus.org/mailman/listinfo/aquaria
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: aquaria-ingredient-data-string-refs.patch
Type: text/x-patch
Size: 22156 bytes
Desc: not available
URL: <http://icculus.org/pipermail/aquaria/attachments/20110426/e28c1edf/attachment-0001.bin>


More information about the aquaria mailing list