Index: trunk/src/board.c =================================================================== --- trunk/src/board.c (revision 25156) +++ trunk/src/board.c (revision 25157) @@ -364,6 +364,8 @@ void pcb_board_changed(int reverted) { + if ((pcb_gui != NULL) && (pcb_gui->set_hidlib != NULL)) + pcb_gui->set_hidlib(&PCB->hidlib); pcb_event(PCB_EVENT_BOARD_CHANGED, "i", reverted); } Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 25156) +++ trunk/src/file_act.c (revision 25157) @@ -146,6 +146,8 @@ */ if (PCB->Changed && conf_core.editor.save_in_tmp) pcb_save_in_tmp(); + if (pcb_gui->set_hidlib != NULL) + pcb_gui->set_hidlib(NULL); pcb_board_remove(PCB); PCB = pcb_board_new(1); pcb_board_new_postproc(PCB, 1); Index: trunk/src/hid.h =================================================================== --- trunk/src/hid.h (revision 25156) +++ trunk/src/hid.h (revision 25157) @@ -551,6 +551,10 @@ /* Open a popup menu addressed by full menu path (starting with "/popups/"). Return 0 on success. */ int (*open_popup)(const char *menupath); + + /* optional: called by core when the global hidlib context changes + (e.g. board changed) */ + void (*set_hidlib)(pcb_hidlib_t *hidlib); }; /* One of these functions (in the common code) will be called whenever the GUI Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 25156) +++ trunk/src/main.c (revision 25157) @@ -672,6 +672,8 @@ if (we_are_exporting) { if (pcb_data_is_empty(PCB->Data)) pcb_message(PCB_MSG_WARNING, "Exporting empty board (nothing loaded or drawn).\n"); + if (pcb_gui->set_hidlib != NULL) + pcb_gui->set_hidlib(&PCB->hidlib); pcb_gui->do_export(0); log_print_uninit_errs("Exporting"); pcb_main_uninit(); @@ -689,6 +691,8 @@ pcb_message(PCB_MSG_ERROR, "%s\n", EXPERIMENTAL); pcb_message(PCB_MSG_ERROR, "******************************** IMPORTANT ********************************\n"); } + if (pcb_gui->set_hidlib != NULL) + pcb_gui->set_hidlib(&PCB->hidlib); pcb_gui->do_export(0); pcb_gui = pcb_next_gui; pcb_next_gui = NULL;