Skip to content

Commit

Permalink
Fixed warning when building with LTO
Browse files Browse the repository at this point in the history
  • Loading branch information
sadko4u committed Dec 22, 2024
1 parent 99e5440 commit a36e49f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/x11/X11Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,10 +1402,11 @@ namespace lsp
if (hWindow <= 0)
return STATUS_BAD_STATE;

size_t n = width * height;
unsigned long *buffer = new unsigned long [n + 2];
const size_t n = width * height;
unsigned long *buffer = reinterpret_cast<unsigned long *>(malloc(sizeof(unsigned long) * (n + 2)));
if (buffer == NULL)
return STATUS_NO_MEM;
lsp_finally { free(buffer); };

buffer[0] = width;
buffer[1] = height;
Expand All @@ -1419,11 +1420,9 @@ namespace lsp
const x11_atoms_t &a = pX11Display->atoms();

XChangeProperty(
pX11Display->x11display(), hWindow,
a.X11__NET_WM_ICON, a.X11_XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<unsigned char *>(buffer), n + 2);

delete [] buffer; // Drop buffer
pX11Display->x11display(), hWindow,
a.X11__NET_WM_ICON, a.X11_XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<unsigned char *>(buffer), n + 2);

return STATUS_OK;
}
Expand Down

0 comments on commit a36e49f

Please sign in to comment.