Looks like I was indeed probably triggering the copy constructor. I *think*
I was returning a struct with an ImageBuf as a member, as in
    return {image_buf, other_stuff};
something changed which meant clang decided not to elide the copy while I
was debugging a separate issue and boom.

On Tue, 11 Apr 2017 at 19:51 Anders Langlands <[email protected]>
wrote:

> Thanks Larry, I've already coded around it, but I'll try and backtrack,
> see if I can reproduce the bug and get you a stack trace.
>
> And yeah, if the buffer is just wrapping a non-owning pointer it makes
> sense to be able to copy it.
>
> Cheers,
>
> Anders
>
> On Tue, 11 Apr 2017 at 19:12 Larry Gritz <[email protected]> wrote:
>
> That assertion appears to be associated with an ImageBuf copy constructor.
> I'm not sure how it can happen for the constructor ImageBuf(ImageSpec&,
> void*buffer).
>
> Are you sure you're not hitting the assertion at some point other than
> when you first construct it as in your example?
>
> Maybe... is it possible you have a function that's intended to receive an
> ImageBuf&, but instead you mis-declared the function as taking an
> 'ImageBuf' so it's passing by value and copy-constructing, instead of
> passing by reference?  (It's also possible it's ME who is doing that
> somewhere.)
>
> I don't suppose I could convince you to use a DEBUG-compiled build of OIIO
> and try to catch it in the debugger and show us the full stack trace?
>
> On my end, I'll try to figure out why I have that assertion there. What
> caused me to think it was invalid to copy an ImageBuf that wrapped a user
> buffer?
>
>
> On Apr 10, 2017, at 11:55 PM, Anders Langlands <[email protected]>
> wrote:
>
> It's along the lines of (as per page 163 of the manual):
>
>     float* data = ...;
>     ImageBuf buf(ImageSpec(correct, params, for, data), data);
>
> This triggers the following assertion:
> libOpenImageIO/imagebuf.cpp
> 390:            ASSERT (0 && "ImageBuf wrapping client buffer not yet
> supported");
>
> On Tue, 11 Apr 2017 at 18:47 Larry Gritz <[email protected]> wrote:
>
> As far as I know, it works. Can you sketch out how you're setting it up
> and exactly what calls you're making?
>
>
> > On Apr 10, 2017, at 10:34 PM, Anders Langlands <
> [email protected]> wrote:
> >
> > Hi there, I just found out the hard way that wrapping a client data
> buffer in an ImageBuf doesn't appear to be implemented (I'm building off
> master). I was hoping to use this as an easy way to write out images given
> a block of pixel data. Is there another way of doing this with the library,
> or should I just create a local-storage ImageBuf and copy my data into it?
> >
> > Cheers,
> >
> > Anders
> >
>
> --
> Larry Gritz
> [email protected]
>
>
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>
>
> --
> Larry Gritz
> [email protected]
>
>
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>
>
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to