Skip to content

Commit

Permalink
fix(InitOutput.c): fix for window pixmap not releasing its resources …
Browse files Browse the repository at this point in the history
…properly on server reset
  • Loading branch information
twaik committed Jan 16, 2025
1 parent c683eb3 commit 9e7b9e3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/src/main/cpp/lorie/InitOutput.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ typedef struct {
DamagePtr damage;
OsTimerPtr fpsTimer;

CloseScreenProcPtr CloseScreen;

int eventFd, stateFd;

struct lorie_shared_server_state* state;
Expand Down Expand Up @@ -493,7 +495,10 @@ static Bool lorieCreateScreenResources(ScreenPtr pScreen) {

static Bool lorieCloseScreen(ScreenPtr pScreen) {
pScreenPtr = NULL;
return fbCloseScreen(pScreen);
pScreen->DestroyPixmap(pScreen->devPrivate);
pScreen->devPrivate = NULL;
pScreen->CloseScreen = pvfb->CloseScreen;
return pScreen->CloseScreen(pScreen);
}

static int lorieSetPixmapVisitWindow(WindowPtr window, void *data) {
Expand Down Expand Up @@ -635,7 +640,6 @@ static Bool lorieScreenInit(ScreenPtr pScreen, unused int argc, unused char **ar
|| !miSetPixmapDepths()
|| !fbScreenInit(pScreen, NULL, pvfb->root.width, pvfb->root.height, monitorResolution, monitorResolution, 0, 32)
|| !(pScreen->CreateScreenResources = lorieCreateScreenResources) // Simply replace unneeded function
|| !(pScreen->CloseScreen = lorieCloseScreen) // Simply replace unneeded function
|| !(!pvfb->dri3 || dri3_screen_init(pScreen, &lorieDri3Info))
|| !fbPictureInit(pScreen, 0, 0)
|| !exaDriverInit(pScreen, &lorieExa)
Expand All @@ -645,6 +649,9 @@ static Bool lorieScreenInit(ScreenPtr pScreen, unused int argc, unused char **ar
|| !present_screen_init(pScreen, &loriePresentInfo))
return FALSE;

pvfb->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = lorieCloseScreen;

ShmRegisterFbFuncs(pScreen);
miSyncShmScreenInit(pScreen);

Expand Down

0 comments on commit 9e7b9e3

Please sign in to comment.