diff --git a/src/frontend/com_hardcopy.c b/src/frontend/com_hardcopy.c index 9734253bc..0db88191f 100644 --- a/src/frontend/com_hardcopy.c +++ b/src/frontend/com_hardcopy.c @@ -8,6 +8,7 @@ #include #include #include +#include "ftedbgra.h" #include "plotting/plotit.h" #include "plotting/graphdb.h" @@ -60,6 +61,10 @@ com_hardcopy(wordlist *wl) /* enable screen plot selection for these display types */ foundit = 0; + /* save current graphics context, because plotit() will create a new + currentgraph */ + PushGraphContext(currentgraph); + #ifndef X_DISPLAY_MISSING if (!wl && hc_button) { @@ -166,5 +171,8 @@ com_hardcopy(wordlist *wl) if (tempf && *device) (void) unlink(fname); + /* restore previous graphics context by retrieving the previous currentgraph */ + PopGraphContext(); + return; }