List Info

Thread: Working with mutiple handles of the same database




Working with mutiple handles of the same database
country flaguser name
Germany
2007-04-04 04:39:00
Hi,

How can I attach a handle twice to the same database file
(read only)
without lots of errors and a crash? The following code
worked at least
without the crash last year.


Regards
Daniel Roßberg


============================================================
======
#include "common.h"
#include "machine.h"
#include "vmath.h"
#include "raytrace.h"


int main
(
    int   argc,
    char* argv[]
) {
    // load demo.g for the first time and select BRL ->
A
    rt_i*     rtip_A = rt_dirbuild("demo.g", 0,
0);
    resource* resp_A =
static_cast<resource*>(calloc(1, sizeof(resource)));
    rt_init_resource(resp_A, 0, rtip_A);
    rt_gettree(rtip_A, "BRL");

    // load demo.g for a second time and select widgets
-> B
    rt_i*     rtip_B = rt_dirbuild("demo.g", 0,
0);
    // !!! a lot of error messages here (rt_memfree,
db_dircheck) !!!
    resource* resp_B =
static_cast<resource*>(calloc(1, sizeof(resource)));
    rt_init_resource(resp_B, 0, rtip_B);
    rt_gettree(rtip_B, "widgets");

    // unload A
    rt_free_rti(rtip_A);

    // unload B
    rt_free_rti(rtip_B);

    // load demo.g again
    rtip_A = rt_dirbuild("demo.g", 0, 0);
    // !!! bu_badmagic !!!

    // exit
    free(resp_A);
    free(resp_B);

    return 0;
}



------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
BRL-CAD Users mailing list
brlcad-userslists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-use
rs

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )