sketch-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sketch on Windows


From: Bernhard Herzog
Subject: Re: Sketch on Windows
Date: Tue, 07 Oct 2003 18:56:06 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

Joonas Paalasmaa <address@hidden> writes:

> Hello all,
>
> I have managed to build all sketch's C extension modules using MSVC++

Cool!

> but I still have some problems running the modules.

:(

> Python crashed, a bit after sktrafo_sktrafo() was called, in
> gcmodule.c's visit_decref(), because there was an access violation
> there.

Does that mean it never entered sktrafo_sktrafo?

> The CVS version i compiled uses GTK2 which should be supported
> on Windows. Sketch didn't compile out of the box using MSVC++, so I made
> the following changes to
> sktrafo.c and to many other files (see
> http://www.python.org/cgi-bin/faqw.py?req=show&file=faq03.024.htp ):
> Added to SKTrafo_FromDouble:
> #if ( __WIN32__ || _WIN32 )
>    self->ob_type = &PyType_Type;
> #endif

Why there? This should be done as soon as the module is imported. See
_SKCurve_InitCurveObject for an example how this could be implemented.

Doing this too late is very likely the reason for the access violation.
The type objects including SKTrafoType are put into the _sketch module's
__dict__ and since their ob_type memeber is NULL until the first object
is instantiated the garbage collector will try to dereference a NULL
pointer when it traverses the objects. So the ob_type has to be set
before init_sketch puts the type objects into the module dict.

> Added just after "PyTypeObject SKTrafoType = {":
> #if ( __WIN32__ || _WIN32 )
>       PyObject_HEAD_INIT(NULL)
> #else
>       PyObject_HEAD_INIT(&PyType_Type)
> #endif - Joonas

Can you submit a patch with your changes to savannah? Preferably after
getting rid of the #ifs. The WIN32 specific version should work on the
other systems as well.

   Bernhard


-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]