On 29 Jan., 16:18, "T. Modes" <[email protected]> wrote:

Okay, I can't think of anything else. You'll have to debug it. Once
you have the stack trace, we can have a look at where the actual crash
occurs and take it from there.

> When I comment out the line with setImage it works. Also only
> def entry ( pano ) :
>         img=pano.getImage(0)
>         img.setYaw(90)

> But this reveals an other bug (or if this a feature). getImage returns
> a const/read only SrcPanoImage. But in the scripting interface I can
> modify the SrcPanoImage. I don't know if this can have side effects
> when using as read/write object in Python.

Of course it can have side effects if the C++ assumes it's object is
'safe' and a nasty bit of Python code gives a damn about it and
changes stuff it's not supposed to change. This is why, ideally, we'd
have an API to hugin on which we could base a stringently defined
scripting interface. No luck here. Just a bunch of freaks trying to
coerce hugin's C++ headers into a usable Python interface. But we
might be lucky and the approach does work out in the end. I have
mentioned that you'll have every opportunity to shoot yourself in the
foot with the code. If it's just a matter of avoiding some methods in
favour of others, so be it. I only fear that the problem you describe
hints at some fundamental problem that exists in Windows and not in
Linux and that needs to be adressed.

I've spent maybe 10% of the time I spent on this project on writing
code, the remainder was mainly reading up stuff. I admit I did not
read about what SWIG does on Windows, or what has to be done on the
Windows Python side to ensure everything runs smoothly. In a way, the
Windows implementation of hsi/hpi is a port - I've written the Linux
code as portable as I could, and it even compiles unmodified and most
of it seems to work. The last bit of finetuning has to be done on the
Windows side by a Windows programmer, and then maybe it turns out that
what I wrote isn't 100% portable after all, but from this end I could
only come up with guesswork.

IFAIK the const declaration will only have an effect inside the C++
code - insofar as a const can't be assigned to in C++ (unless you
cast). SWIG translates the reference into a pointer. The pointer
itself just points to the object - the object lives in ordinary memory
which is in no way different whether the object or the pointer to it
are declared const or not. Since Python refers to the object via a
pointer, it can manipulate the data. If you want a more in-depth
discussion of const and SWIG, maybe the SWIG documentation '5.2.4 A
brief word about const' and '6.27 A brief rant about const-
correctness' is helpful.

Anyway, the code of setImage is a bit strange:

        void setImage(std::size_t nr, SrcPanoImage img)
        {
            setSrcImage(nr, img);
        };

So it receives a SrcPanoImage by value. Next it calls a function that
takes a reference to this image, which proceeds to copy the image
variables into the target image. Why setImage() doesn't take a const
SrcPanoImage& in the first place is a mystery to me...

So this is how it goes - as one of our esteemed colleagues always
finishes his posts: in theory there is no difference between theory
and practise, in practise there is. It's just like that with multi-
platform programming. In theory there shouldn't be a differnce between
Linux and Windows...

Sorry I can't be more helpful. I don't even have MSVC, when I still
used Windows, I did all C++ programming with cygwin or minGW. But I'll
gladly look at whatever debugging results you come up with. Just 'it
crashes' isn't enough information to go by. I really want this thing
to take off, and having it run on Windows is a part that's necessary,
even though I'd gladly do without Windows altogether. I just can't
help so well on the Windows side of things, much as I'd like to.

Kay

-- 
You received this message because you are subscribed to the Google Groups 
"Hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/hugin-ptx

Reply via email to