#musicbrainz

/

      • deadchip
        basically where it breaks is:
      • 2006-02-20 05106, 2006

      • deadchip
        this seems to succeed:
      • 2006-02-20 05108, 2006

      • deadchip
        ret = mb_Query (o, MBQ_GetCDTOC);
      • 2006-02-20 05112, 2006

      • deadchip
        but here it crashes then:
      • 2006-02-20 05126, 2006

      • deadchip
        err no this succeeds too:
      • 2006-02-20 05128, 2006

      • deadchip
        ret = mb_GetResultData(o, MBE_TOCGetCDIndexId, data, 256);
      • 2006-02-20 05130, 2006

      • deadchip
        and here's the crash:
      • 2006-02-20 05134, 2006

      • deadchip
        ret = mb_QueryWithArgs(o, MBQ_GetCDInfoFromCDIndexId, args);
      • 2006-02-20 05139, 2006

      • nikki_
        eeek
      • 2006-02-20 05145, 2006

      • nikki_ recommends a pastebin
      • 2006-02-20 05149, 2006

      • deadchip
        err
      • 2006-02-20 05150, 2006

      • deadchip
        yeah
      • 2006-02-20 05152, 2006

      • deadchip
        right, moment
      • 2006-02-20 05130, 2006

      • inhouseuk has quit
      • 2006-02-20 05154, 2006

      • inhouseuk joined the channel
      • 2006-02-20 05116, 2006

      • inhouseuk
        stupid net connection :(
      • 2006-02-20 05151, 2006

      • deadchip
        i think the actual code is not so interesting
      • 2006-02-20 05101, 2006

      • deadchip
        as it's just a modified version of your own getalbum.c example
      • 2006-02-20 05106, 2006

      • deadchip
        i'll rather just paste the diff of what i've changed
      • 2006-02-20 05125, 2006

      • deadchip
        (basically only added reading the cdindex disc id off the disc itself instead of having to specify it on the command line)
      • 2006-02-20 05148, 2006

      • deadchip
      • 2006-02-20 05150, 2006

      • deadchip
        ok this is the diff
      • 2006-02-20 05156, 2006

      • deadchip
        now, there is no problem with this
      • 2006-02-20 05109, 2006

      • deadchip
        if i compile it with just gcc -o getalbum getalbum.c -lmusicbrainz -lstdc++
      • 2006-02-20 05110, 2006

      • deadchip
        and run it
      • 2006-02-20 05122, 2006

      • deadchip
        it will print me all the information for the current disc without any problem or anything
      • 2006-02-20 05132, 2006

      • deadchip
        if copy&paste the exact same code into our app, it crashes
      • 2006-02-20 05134, 2006

      • deadchip
        like this:
      • 2006-02-20 05139, 2006

      • deadchip pastes the full bt
      • 2006-02-20 05151, 2006

      • inhouseuk
        deadchip: let me look at my code
      • 2006-02-20 05110, 2006

      • deadchip
        just btw the app is not so beta as it's likely that there is a memory corruption involved
      • 2006-02-20 05124, 2006

      • deadchip
        i don't want to say it's impossible but in this case, let's say it's rather unlikely, for now
      • 2006-02-20 05112, 2006

      • deadchip
      • 2006-02-20 05116, 2006

      • deadchip
        this is the gdb bt
      • 2006-02-20 05121, 2006

      • LTjake has quit
      • 2006-02-20 05102, 2006

      • deadchip
        the code in bmp_ui_callback_add_cd()
      • 2006-02-20 05118, 2006

      • inhouseuk
        deadchip: if you're using MBQ_GetCDInfo you don't need to do MBQ_GetCDInfoFromCDIndexId as well
      • 2006-02-20 05120, 2006

      • deadchip
        is for now, that is with the given bt, identical to the standalone compiled code with my changes to read the cdindex
      • 2006-02-20 05136, 2006

      • deadchip
        inhouseuk, allright but why does it work standalone yet crashes in the app?
      • 2006-02-20 05142, 2006

      • deadchip
        and if i don't need that, what should i do instead?
      • 2006-02-20 05148, 2006

      • deadchip
        err
      • 2006-02-20 05150, 2006

      • deadchip
        GetCDInfo
      • 2006-02-20 05151, 2006

      • deadchip
        hmm
      • 2006-02-20 05159, 2006

      • deadchip
        i'm not using that
      • 2006-02-20 05103, 2006

      • deadchip
        inhouseuk, you didn't look at my diff
      • 2006-02-20 05107, 2006

      • deadchip
        you only looked at your own code
      • 2006-02-20 05113, 2006

      • deadchip
        i've said i've modified it to read the cdindex off the disc
      • 2006-02-20 05121, 2006

      • deadchip
        so it doesn't use GetCDInfo
      • 2006-02-20 05127, 2006

      • deadchip
        but GetCDInfoFromCDIndexId
      • 2006-02-20 05130, 2006

      • deadchip
        please look at my paste LOL
      • 2006-02-20 05152, 2006

      • deadchip
        the problem is an entirely different one namely that the code works standalone but not inside our app
      • 2006-02-20 05119, 2006

      • deadchip
        it took me an hour or so to get into how to code with the client lib but once i got that i've modified the getalbum.c code to just read the cdindex itself
      • 2006-02-20 05137, 2006

      • deadchip
        and that works, but not if i put it into our code, 1:1 mind you, non-modified right now, and it's still crashing
      • 2006-02-20 05149, 2006

      • deadchip
        i'm not saying libmb is at fault or something, i just don't know where to start debugging
      • 2006-02-20 05102, 2006

      • nikki_
        I'm going to bed now
      • 2006-02-20 05119, 2006

      • deadchip
        nite
      • 2006-02-20 05130, 2006

      • nikki_ has quit
      • 2006-02-20 05147, 2006

      • LjL has quit
      • 2006-02-20 05132, 2006

      • deadchip
        i guess the question would be under which conditions can libmb malfunction in this way when the same code works in a testcase?
      • 2006-02-20 05155, 2006

      • BGreeNZ
        inhouseuk: Just before you go too, is there any way to *copy* (rather than move) a discID from one album to another?
      • 2006-02-20 05102, 2006

      • inhouseuk
        deadchip: cpp_example.cpp shows a better method of doing it than modifying getalbum
      • 2006-02-20 05118, 2006

      • deadchip
        inhouseuk, well i'm using the C api for a purpose
      • 2006-02-20 05124, 2006

      • deadchip
        cause our app is written in C
      • 2006-02-20 05134, 2006

      • inhouseuk
        BGreeNZ: no, it isn't possible to copy the discid
      • 2006-02-20 05141, 2006

      • deadchip
        i know it's late, and i'm bugging you, and you don't know me
      • 2006-02-20 05151, 2006

      • inhouseuk
        deadchip: it uses exactly the same api
      • 2006-02-20 05156, 2006

      • deadchip
        but this all still doesn't explain the problem
      • 2006-02-20 05130, 2006

      • deadchip
        inhouseuk, ok but do you have an explanation as for why it works standalone but possibly not inside an application (this isn't meant as an inquiry, but just as a question...)
      • 2006-02-20 05112, 2006

      • inhouseuk
        not sure, compare the value of args in the standalone and your version
      • 2006-02-20 05124, 2006

      • deadchip
        hmm right
      • 2006-02-20 05100, 2006

      • deadchip
        cdindex:QCPAxdxK5dGfjxZ0NnVZBtyg8.w- <-- standalone code
      • 2006-02-20 05103, 2006

      • deadchip
        doesn't even get to print it in the app
      • 2006-02-20 05137, 2006

      • deadchip
        i think it gets as far as reading the TOC
      • 2006-02-20 05147, 2006

      • deadchip
        but then acquiring the cdindex doesn't work anymore
      • 2006-02-20 05157, 2006

      • deadchip
        can i enable debug somehow?
      • 2006-02-20 05102, 2006

      • deadchip
        i tried to use mb_SetDebug(0
      • 2006-02-20 05103, 2006

      • deadchip
        err
      • 2006-02-20 05106, 2006

      • deadchip
        mb_SetDebug()
      • 2006-02-20 05114, 2006

      • deadchip
        but that doesn't print anything
      • 2006-02-20 05152, 2006

      • deadchip
        or can i get a printout of the state of the musicbrainz_t instance?
      • 2006-02-20 05100, 2006

      • deadchip
        or something like that; a sanity check, etc
      • 2006-02-20 05106, 2006

      • inhouseuk
        mb_SetDebug(o, 1)
      • 2006-02-20 05134, 2006

      • inhouseuk
        should print the RDF query and result to stderr
      • 2006-02-20 05137, 2006

      • deadchip
        ah
      • 2006-02-20 05138, 2006

      • deadchip
        ok
      • 2006-02-20 05141, 2006

      • deadchip
        hmm
      • 2006-02-20 05108, 2006

      • deadchip
        ok i've enabled debuggin printout, but it prints nothing
      • 2006-02-20 05113, 2006

      • deadchip
        it gets as far as this:
      • 2006-02-20 05117, 2006

      • deadchip
        (apprently successful)
      • 2006-02-20 05122, 2006

      • deadchip
        ret = mb_Query (o, MBQ_GetCDTOC);
      • 2006-02-20 05129, 2006

      • deadchip
        and then i make the function return for now
      • 2006-02-20 05139, 2006

      • deadchip
        now when i add the next step
      • 2006-02-20 05106, 2006

      • deadchip
        this: ret = mb_GetResultData(o, MBE_TOCGetCDIndexId, data, 256);
      • 2006-02-20 05125, 2006

      • inhouseuk
        what are you getting as a return code on mb_Query (o, MBQ_GetCDTOC);
      • 2006-02-20 05111, 2006

      • deadchip
        that gives:
      • 2006-02-20 05121, 2006

      • deadchip
        BMPx-Message: 1
      • 2006-02-20 05115, 2006

      • deadchip
        so succeeds
      • 2006-02-20 05116, 2006

      • deadchip
        it*
      • 2006-02-20 05144, 2006

      • deadchip
        this is where it crashes ret = mb_GetResultData(o, MBE_TOCGetCDIndexId, data, 256);
      • 2006-02-20 05152, 2006

      • deadchip
        and i don't get why
      • 2006-02-20 05129, 2006

      • deadchip
        i don't see a reason why it would, i don't know the API for long but this isn't even code that i have written but is one of your testcases which works standalone, so i'd say our app misbehaves
      • 2006-02-20 05147, 2006

      • deadchip
        but there's no apparent reason or evidence for that either leaves me clueless
      • 2006-02-20 05157, 2006

      • inhouseuk
        MBE_TOCGetCDIndexId isn't in any of the example code
      • 2006-02-20 05107, 2006

      • deadchip
        i know
      • 2006-02-20 05129, 2006

      • deadchip
      • 2006-02-20 05138, 2006

      • deadchip
        the modified code, just compile it throw in an audio CD and run it
      • 2006-02-20 05144, 2006

      • deadchip
        the exact same code crashes in the app
      • 2006-02-20 05147, 2006

      • inhouseuk
        at the point MBE_TOCGetCDIndexId is called, it is expecting to have a query result already returned containing a list of discids
      • 2006-02-20 05107, 2006

      • deadchip
        yes but why does it work in the standalone code?
      • 2006-02-20 05123, 2006

      • deadchip
        i mean it's your code
      • 2006-02-20 05136, 2006

      • deadchip
        if you look at my modified version of getalbum.c, you'll see that the API is used right
      • 2006-02-20 05157, 2006

      • inhouseuk
        I suspect you might have been caught out by the lack of documentation on the API
      • 2006-02-20 05118, 2006

      • deadchip
        ok, but what am i missing out then?
      • 2006-02-20 05117, 2006

      • inhouseuk
        I recommend you use the method shown in cpp_example.cpp
      • 2006-02-20 05122, 2006

      • deadchip
        ok
      • 2006-02-20 05141, 2006

      • inhouseuk
        some of the documentation is horrid
      • 2006-02-20 05149, 2006

      • deadchip
        lol
      • 2006-02-20 05107, 2006

      • deadchip
        ok i'm changing the code
      • 2006-02-20 05121, 2006

      • deadchip
        hmm the cpp_example.cpp is actually also by mileages shorter heh
      • 2006-02-20 05143, 2006

      • deadchip
        tbh i didn't look at it at all, i've expected it to be C++ code
      • 2006-02-20 05147, 2006

      • deadchip
        well it is C++ code
      • 2006-02-20 05149, 2006

      • deadchip
        mm
      • 2006-02-20 05113, 2006

      • deadchip
        but i guess i can adapt it to the C API
      • 2006-02-20 05150, 2006

      • inhouseuk
        but all you need as information in that code is the calls
      • 2006-02-20 05138, 2006

      • inhouseuk
        it won't take much work to convert that to C
      • 2006-02-20 05140, 2006

      • deadchip
        yeah
      • 2006-02-20 05147, 2006

      • deadchip
        already done actually heh
      • 2006-02-20 05159, 2006

      • deadchip
        ok lets see
      • 2006-02-20 05110, 2006

      • deadchip
        crashes as well
      • 2006-02-20 05127, 2006

      • inhouseuk
        strange
      • 2006-02-20 05133, 2006

      • inhouseuk
        was that standalone?
      • 2006-02-20 05135, 2006

      • deadchip
        #2 0x0082a4fd in mb_QueryWithArgs () from /usr/lib/libmusicbrainz.so.4
      • 2006-02-20 05138, 2006

      • deadchip
        no that was inside the app
      • 2006-02-20 05147, 2006

      • deadchip
        i'll compile a C-ified version standalone now, sec
      • 2006-02-20 05112, 2006

      • deadchip
        mh
      • 2006-02-20 05124, 2006

      • deadchip
        we're going to need the cdindex value anyway but that's not important yet
      • 2006-02-20 05152, 2006

      • deadchip
        we're using it so we can uniquely cache metadata for audio cds inside our metadata cache without the need for a separate storage for cdda:/// URIs
      • 2006-02-20 05154, 2006

      • deadchip
        we encode it like this:
      • 2006-02-20 05103, 2006

      • deadchip
        cdda://<cdindex id here>/<track number>
      • 2006-02-20 05114, 2006

      • deadchip
        since the URI is the pkey in our database, this makes it possible to store items uniquely
      • 2006-02-20 05126, 2006

      • deadchip
        which wouldn't work if we just used cdda:///1, etc
      • 2006-02-20 05145, 2006

      • BGreeNZ
        inhouseuk: I'm having trouble moving the discID from http://test.musicbrainz.org/showalbum.html?albumi… to http://test.musicbrainz.org/album/eb750ae4-97c0-4… (to make it look authentic as the target album)
      • 2006-02-20 05146, 2006

      • deadchip
        but that aside if it worked in the first place LOL then i can see about the cdindex id
      • 2006-02-20 05103, 2006

      • inhouseuk
        you are setting mb_SetDevice somewhere in your app?
      • 2006-02-20 05116, 2006

      • deadchip
        hmm
      • 2006-02-20 05121, 2006

      • deadchip
        nope
      • 2006-02-20 05130, 2006

      • deadchip
        the standalone code doesn't either so i guess it defaults to /dev/cdrom
      • 2006-02-20 05133, 2006

      • deadchip
        i'll add it explicitely
      • 2006-02-20 05100, 2006

      • deadchip
        ok now..
      • 2006-02-20 05102, 2006

      • deadchip
        the debug