mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-06 02:01:50 +08:00
only increase refcount for surface create for window and menu created by the server
This commit is contained in:
@@ -815,6 +815,9 @@ static int srvAllocZOrderNode (int cli, HWND hwnd, HWND main_win,
|
||||
if (cli == 0) {
|
||||
PMAINWIN pwin = (PMAINWIN)hwnd;
|
||||
surf = pwin->surf;
|
||||
|
||||
// prevent to free this surface when deleting memdc for znode.
|
||||
surf->refcount++;
|
||||
}
|
||||
else if (fd >= 0) {
|
||||
surf = GAL_AttachSharedRGBSurface (fd, surf_size, surf_flags, TRUE);
|
||||
@@ -827,6 +830,7 @@ static int srvAllocZOrderNode (int cli, HWND hwnd, HWND main_win,
|
||||
|
||||
if (surf) {
|
||||
memdc = CreateMemDCFromSurface (surf);
|
||||
_WRN_PRINTF ("surface (%p) refcount: %d\n", surf, surf->refcount);
|
||||
if (memdc == HDC_INVALID) {
|
||||
if (cli > 0) {
|
||||
GAL_FreeSurface (surf);
|
||||
@@ -961,7 +965,7 @@ static int srvMoveWindow (int cli, int idx_znode, const RECT* rcWin,
|
||||
if (cli == 0) {
|
||||
PMAINWIN pwin = (PMAINWIN)hwnd;
|
||||
surf = pwin->surf;
|
||||
// increase refcount for not freed by DeleteMemDC in dskMoveWindow.
|
||||
// prevent to free this surface when deleting memdc for znode.
|
||||
surf->refcount++;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1570,6 +1570,8 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
|
||||
GAL_Surface* surf;
|
||||
if (cli == 0) {
|
||||
surf = GetSurfaceFromDC (((PTRACKMENUINFO)ptmi)->dc);
|
||||
// prevent to free this surface when deleting memdc for znode.
|
||||
surf->refcount++;
|
||||
}
|
||||
else if (fd >= 0) {
|
||||
surf = GAL_AttachSharedRGBSurface (fd, surf_size, surf_flags, TRUE);
|
||||
|
||||
Reference in New Issue
Block a user