@@ -335,6 +335,8 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
335
335
336
336
/* load the dictionary / affixes if not yet defined */
337
337
if (shdict == NULL ) {
338
+
339
+ elog (WARNING , "shdict not found" );
338
340
339
341
dict = (IspellDict * )palloc0 (sizeof (IspellDict ));
340
342
@@ -369,8 +371,10 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
369
371
370
372
} else {
371
373
374
+ /* local copy, so that we can change the pointers */
375
+ SharedIspellDict * shdict_local = NULL ;
376
+
372
377
/* we got the dictionary, but we need to reload the affixes (to handle regex_t rules) */
373
-
374
378
dict = (IspellDict * )palloc0 (sizeof (IspellDict ));
375
379
376
380
NIStartBuild (dict );
@@ -386,6 +390,14 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
386
390
387
391
NIFinishBuild (dict );
388
392
393
+ /* now, we need to create a local copy of the shared dictionary, so that we can modify the
394
+ * pointers locally (without breaking the other backends) */
395
+ shdict_local = (SharedIspellDict * )palloc (sizeof (SharedIspellDict ));
396
+ memcpy (shdict_local , shdict , sizeof (SharedIspellDict ));
397
+
398
+ /* keep the local only */
399
+ shdict = shdict_local ;
400
+
389
401
shdict -> Suffix = dict -> Suffix ;
390
402
shdict -> Prefix = dict -> Prefix ;
391
403
0 commit comments