Re: [crossfire] plugin crash on metalforge.

2007-02-15 Thread Nicolas Weeger
Le jeudi 15 février 2007 08:42, Mark Wedel a écrit :
   Looking at some of the crashes on metalforge, which is latest 1.x as of a
 week ago.  Saw 2 crashes wit the same cause.  From the logfile:

Ok, that was a fun bug :)

Chain of events:
* you gain at the slot machine
* slot machine creates platinum coin
* slot machine puts coin in map
* slot machine adjusts object count and such

But the fun part is that the slot machine is an altar eating platinum coins.
So when the coins are put on the map, the altar just eats them.

There, the Python plugin just kept a pointer to removed object, so you had 
weird issues later on :)
(especially with object reuse).

I fixed by correctly getting object returned by cf_map_insert_object :)

Now to fix the Python script itself, since now you don't get any money^_-


Nicolas
-- 
http://nicolas.weeger.free.fr [Petit site d'images, de textes, de code, bref 
de l'aléatoire !]

___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire


[crossfire] plugin crash on metalforge.

2007-02-14 Thread Mark Wedel

  Looking at some of the crashes on metalforge, which is latest 1.x as of a 
week 
ago.  Saw 2 crashes wit the same cause.  From the logfile:

[Debug]   ** EVENT HANDLER **
[Debug]- Who am I  :Moneygoose
[Debug]- Activator :reaper
[Debug]- Event code:1
[Debug]- Event plugin  :Python
[Debug]- Event hook:/python/casino/platinumslots.py
[Debug]- Event options :event_apply
/home/crossfire/share/crossfire/maps/python/CFItemBroker.py:23: 
DeprecationWarning: integer argument expected, got float
   self.object.Quantity=tmp
[Debug]   ** EVENT HANDLER **
[Debug]- Who am I  :event_destroy
[Debug]- Event code:13
[Debug]- Event plugin  :Python
[Debug]- Event hook:cfpython_auto_hook
[Debug]- Event options :event_destroy
[Error]   Trying to remove removed object.
arch event_destroy
name event_destroy
name_pl event_destroy
title Python
slaying cfpython_auto_hook
nrof 53
type 116
subtype 13
end

  the offending code is Crossfire_Player_dealloc() in 
plugins/cfpython/cfpython_object.c:

static void Crossfire_Player_dealloc(PyObject *obj)
{
 Crossfire_Player *self;
 self = (Crossfire_Player *)obj;
 if(self) {
 if (self-obj  self-valid) {
 free_object_assoc(self-obj);
 if (self-del_event) {
 cf_object_remove(self-del_event);
 cf_free_object(self-del_event);
 }
 }
 self-ob_type-tp_free(obj);
 }
}

  In this particular case, self-obj == self-del_event, which is why I think 
this may be getting freed twice, but not 100% sure of that.  Can someone with 
more plugin exp look at this?


___
crossfire mailing list
crossfire@metalforge.org
http://mailman.metalforge.org/mailman/listinfo/crossfire