Skip to content

Commit

Permalink
FIX: fixed memory leak in window compositor
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Mar 8, 2019
1 parent 12a1ac1 commit 68bdaa7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/os/win32/host-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ static REBCNT Get_Widget_Text(HWND widget, REBVAL *text);
for (n = 0; n < MAX_WINDOWS; n++) {
if (Gob_Windows[n].gob == 0) {
Gob_Windows[n].gob = gob;
Gob_Windows[n].compositor = OS_Create_Compositor(Gob_Root, gob);
// note: don't create compositor here,
// it will be done when its class is registered
return n;
}
}
Expand Down Expand Up @@ -261,7 +262,7 @@ static REBCNT Get_Widget_Text(HWND widget, REBVAL *text);
for (n = 0; n < MAX_WINDOWS; n++) {
if (Gob_Windows[n].gob == gob) {
OS_Destroy_Compositor(Gob_Windows[n].compositor);
Gob_Windows[n].gob = 0;
CLEAR(&Gob_Windows[n], sizeof(Gob_Windows[n]));
return;
}
}
Expand Down Expand Up @@ -459,6 +460,9 @@ static REBCNT Get_Widget_Text(HWND widget, REBVAL *text);
Host_Crash("CreateWindow failed");
}

Gob_Windows[windex].win = window;
Gob_Windows[windex].compositor = OS_Create_Compositor(Gob_Root, gob);

if (!Default_Font) {
LOGFONTW font;
HTHEME *hTheme = NULL;
Expand Down Expand Up @@ -488,9 +492,6 @@ static REBCNT Get_Widget_Text(HWND widget, REBVAL *text);
if (GET_GOB_FLAG(gob, GOBF_DROPABLE))
DragAcceptFiles(window, TRUE);

Gob_Windows[windex].win = window;
Gob_Windows[windex].compositor = OS_Create_Compositor(Gob_Root, gob);

SET_GOB_FLAG(gob, GOBF_WINDOW);
SET_GOB_FLAG(gob, GOBF_ACTIVE);
SET_GOB_STATE(gob, GOBS_OPEN);
Expand Down

0 comments on commit 68bdaa7

Please sign in to comment.