Fix bug 624 also for MS Windows

by moving DestroyGraph() from WM_CLOSE to RemoveWindow()
This commit is contained in:
Holger Vogt 2023-02-25 15:40:21 +01:00
parent bd30bd4e85
commit 75f9451702
1 changed files with 7 additions and 7 deletions

View File

@ -645,14 +645,7 @@ LRESULT CALLBACK PlotWindowProc(HWND hwnd, UINT uMsg,
case WM_CLOSE: /* close window */
{
GRAPH *g = pGraph(hwnd);
if (g) {
/* if g equals currentgraph, reset currentgraph. */
if (g == currentgraph)
currentgraph = NULL;
DestroyGraph(g->graphid);
}
}
goto WIN_DEFAULT;
@ -1233,6 +1226,13 @@ void RemoveWindow(GRAPH *dgraph)
wd = pWindowData(dgraph);
if (wd)
SendMessage(wd->wnd, WM_CLOSE, (WPARAM) wd->hDC, 0);
if (dgraph) {
/* if g equals currentgraph, reset currentgraph. */
if (dgraph == currentgraph)
currentgraph = NULL;
DestroyGraph(dgraph->graphid);
}
}