<div dir="ltr"><div><div><div>I'm building a C++ application using redland and Wt (<a href="http://webtoolkit.eu">http://webtoolkit.eu</a>).  I've got a web form with two combo boxes, one for displaying all the predicates in my RDF model, and another which I'm trying to dynamically repopulate with all of the values that are used by the predicate selected in the first one.<br><br>The initial rendering of the web form loads up with both of the combo boxes populated correctly (an arbitrary predicate in the first combo box, and the proper values go with it in the second).  However, if you change the predicate combo box, my program will segfault, in librdf_get_query_factory(), on the line `if(name && !strcmp(factory->name, name)) {`, because:<br><br>(gdb) print factory->name<br>$1 = 0x4c25048b64000000 <error: Cannot access memory at address 0x4c25048b64000000><br><br>librdf_get_query_factory() was called by librdf_new_query(), which my code invoked directly with the following parameters:<br><br>(gdb) print world<br>$3 = (librdf_world *) 0x7fffe5a12340<br>(gdb) print name<br>$4 = 0x448f15 "sparql"<br>(gdb) print uri<br>$5 = (librdf_uri *) 0x0<br>(gdb) print query_string<br>$6 = (const unsigned char *) 0x7fffc8002298 "SELECT DISTINCT ?value WHERE { ?_ <<a href="http://www.nps.gov/planTs/pubs/chesapeake/SoilType">http://www.nps.gov/planTs/pubs/chesapeake/SoilType</a>> ?value }"<br>(gdb) print base_uri<br>$7 = (librdf_uri *) 0x0<br><br>The world object is the same one I used to construct query objects for the initial population of the combo boxes, which, again, worked just fine.<br><br>I have unit tests around my code which is calling librdf_new_query(), and in my test runs the code constructs and executes query after query, without any problems.  So maybe there's something special about this full-fledged Wt runtime environment? (The stack is 30 calls deep...)  That's obviously a question for Wt-dev, not redland-dev, but...<br><br>Since the crash is happening within librdf, I thought I would start here first.<br><br>I see on the prior line in librdf_get_query_factory() that factory comes from world->query_factories.  How could a world object get messed up like this?<br><br>Could it be a multi-threading issue?  It COULD be that Wt is using a different thread to handle the re-population than it did for the initial population.  I tried rebuilding raptor/rasqal/redland with the --with-threads configure option, but that didn't seem to have any effect...<br><br></div>Any ideas?  I'm having trouble even coming up with a hypothesis to test...<br><br>I could post my code somewhere, if someone would like to take a look, but it's relatively complicated, what with all the Wt stuff.  My efforts to recreate the problem in a simple unit test have so far been in vain. :(<br><br></div>Thanks in advance!<br></div>Gene<br></div>