@@ -335,6 +335,8 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
335335
336336/* load the dictionary / affixes if not yet defined */
337337if (shdict == NULL ) {
338+
339+ elog (WARNING ,"shdict not found" );
338340
339341dict = (IspellDict * )palloc0 (sizeof (IspellDict ));
340342
@@ -369,8 +371,10 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
369371
370372 }else {
371373
374+ /* local copy, so that we can change the pointers */
375+ SharedIspellDict * shdict_local = NULL ;
376+
372377/* we got the dictionary, but we need to reload the affixes (to handle regex_t rules) */
373-
374378dict = (IspellDict * )palloc0 (sizeof (IspellDict ));
375379
376380NIStartBuild (dict );
@@ -386,6 +390,14 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
386390
387391NIFinishBuild (dict );
388392
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+
389401shdict -> Suffix = dict -> Suffix ;
390402shdict -> Prefix = dict -> Prefix ;
391403