[xml] =?ISO-8859-1?Q?Re=3A=20=27RE=3A=20=5Bxml=5D=20Initialization=22=27?=



Hi,

on 4/28/2004 1:47 PM Ohad Oded wrote:

Hi, 
Now I'm experiencing problem in the following sequence (I'm using
WIN32):
Thread A calls xmlInitParser().
.
.
.
Thread A calls xmlCleanupParser().
.
.
.
Thread B calls xmlInitParser()

The code of xmlInitParser() from thread B crashes, I think it has to do
with the fact that it's not the same thread that initially called
xmlInitParser() (thread A). It crashes in __xmlGenericError within
IS_MAIN_THREAD and the problem is that run_once_init was not set back to
0 in xmlCleanupParser() (I'm not sure if intentionally or not).

As said before: "xmlCleanupParser" is intended to be called only once at 
finalization time of the library, not in-between. Put your call of 
"xmlCleanupParser" outside your thread mechanism, i.e. into the main thread.

on 4/28/2004 9:44 AM Ohad Oded wrote:


Hi, 



I'm experiencing an access violation.

When working with xmlParseFile() everything is ok.

However when working with xmlReaderForMemory() I have an access
violation because xmlInitParser() wasn't called.

Is this intentional (meaning I have to call it myself)? 


Yes, "xmlInitParser" needs to be called to initialize the library; this 
function is reentrant, so don't care how often you call it. Some libxml2

functions call "xmlInitParser", so you were just lucky in the case of 
"xmlParseFile". Note that it initializes the library only, it is not 
designated to be called before parsing (its name is a bit misleading). 
Additionally, "xmlCleanupParser" needs to be called to finalize the
library.


Regards,

Kasimier

Kasimier




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]