From a765857aaa450862f6a3dc5de811671fbc82ca61 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 1 Jun 2019 00:52:06 +0200 Subject: Remove the Must_have_memory hack. We are not using any alloc function that respects that variable, so lets drop it. Backport of this commit: commit 0ce61e21d6d7dcca0090e319bbcdb678570f2c3f Author: Adam Jackson Date: Fri Oct 3 16:05:19 2008 -0400 Remove the Must_have_memory hack. Also remove an astonishing amount of misunderstanding of how casts work. --- nx-X11/programs/Xserver/mi/micursor.c | 12 ++++-------- nx-X11/programs/Xserver/mi/migc.c | 6 ++---- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'nx-X11/programs/Xserver/mi') diff --git a/nx-X11/programs/Xserver/mi/micursor.c b/nx-X11/programs/Xserver/mi/micursor.c index e95c43b3d..90b0f2ae9 100644 --- a/nx-X11/programs/Xserver/mi/micursor.c +++ b/nx-X11/programs/Xserver/mi/micursor.c @@ -53,8 +53,6 @@ SOFTWARE. #include "misc.h" #include "mi.h" -extern Bool Must_have_memory; - void miRecolorCursor( pScr, pCurs, displayed) ScreenPtr pScr; @@ -65,11 +63,9 @@ miRecolorCursor( pScr, pCurs, displayed) * This is guaranteed to correct any color-dependent state which may have * been bound up in private state created by RealizeCursor */ - (* pScr->UnrealizeCursor)( pScr, pCurs); - Must_have_memory = TRUE; /* XXX */ - (* pScr->RealizeCursor)( pScr, pCurs); - Must_have_memory = FALSE; /* XXX */ - if ( displayed) - (* pScr->DisplayCursor)( pScr, pCurs); + pScr->UnrealizeCursor(pScr, pCurs); + pScr->RealizeCursor(pScr, pCurs); + if (displayed) + pScr->DisplayCursor(pScr, pCurs); } diff --git a/nx-X11/programs/Xserver/mi/migc.c b/nx-X11/programs/Xserver/mi/migc.c index 4d67cbf5d..afd5031a4 100644 --- a/nx-X11/programs/Xserver/mi/migc.c +++ b/nx-X11/programs/Xserver/mi/migc.c @@ -68,11 +68,9 @@ miCreateGCOps(prototype) { GCOpsPtr ret; - /* XXX */ Must_have_memory = TRUE; - ret = (GCOpsPtr) malloc(sizeof(GCOps)); - /* XXX */ Must_have_memory = FALSE; + ret = malloc(sizeof(GCOps)); if (!ret) - return 0; + return NULL; *ret = *prototype; ret->devPrivate.val = 1; return ret; -- cgit v1.2.3 From 28e42b3bd0d7fb5d5674acd256fed5e84903a271 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 4 May 2019 01:44:36 +0200 Subject: mi: Hush an almost certainly bogus warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 57e872301f5e836be2efb8f952f9c9711650b447 Author: Adam Jackson Date: Thu Apr 5 13:07:09 2018 -0400 mi: Hush an almost certainly bogus warning In file included from ../mi/miexpose.c:83: ../mi/miexpose.c: In function ‘miHandleExposures’: ../include/regionstr.h:174:22: warning: ‘expBox.y2’ may be used uninitialized in this function [-Wmaybe-uninitialized] (_pReg)->extents = *(_pBox); ~~~~~~~~~~~~~~~~~^~~~~~~~~~ ../mi/miexpose.c:139:12: note: ‘expBox.y2’ was declared here BoxRec expBox; ^~~~~~ etc. It's initialized if (extents), and then only read if (extents), but gcc doesn't seem to figure that out. Whatever, bzero it to be explicit. Signed-off-by: Adam Jackson Acked-by: Keith Packard --- nx-X11/programs/Xserver/mi/miexpose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/programs/Xserver/mi') diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index 8e60f475e..274a8d4ce 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -151,7 +151,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable, the window background */ WindowPtr pSrcWin; - BoxRec expBox; + BoxRec expBox = { 0, }; Bool extents; /* This prevents warning about pscr not being used. */ -- cgit v1.2.3 From b961e190bc69bc93cb1f3fd6cbff7e9c1247de25 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 1 May 2019 02:06:30 +0200 Subject: miwindow.c: add hint to Red Hat Bugzilla + fix --- nx-X11/programs/Xserver/mi/miwindow.c | 1 + 1 file changed, 1 insertion(+) (limited to 'nx-X11/programs/Xserver/mi') diff --git a/nx-X11/programs/Xserver/mi/miwindow.c b/nx-X11/programs/Xserver/mi/miwindow.c index 2a583eda7..c696caf26 100644 --- a/nx-X11/programs/Xserver/mi/miwindow.c +++ b/nx-X11/programs/Xserver/mi/miwindow.c @@ -1052,6 +1052,7 @@ miSetShape(pWin) * pointer to the parent, so maybe doesn't change * the attribute of the window itself. This is to * be better investigated. + * Update: Red Hat fixed this bug the same way (BZ 676270). */ if (WasViewable && pOldClip) -- cgit v1.2.3 From 5cb497146091acf84f389f6b459f5d2f8ea86643 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Tue, 18 Jun 2019 18:57:17 +0200 Subject: mi/miinitext.c: fix memleaks: remove (double) glx initialization Fix these memory leaks: ==30021== 128 bytes in 1 blocks are definitely lost in loss record 230 of 302 ==30021== at 0x483577F: malloc (vg_replace_malloc.c:299) ==30021== by 0x2EF89C: init_visuals (xf86glx.c:390) ==30021== by 0x2EF89C: __MESA_initVisuals (xf86glx.c:541) ==30021== by 0x17C922: GlxInitVisuals (glxext.c:317) ==30021== by 0x218E73: fbInitVisuals (fbcmap.c:668) ==30021== by 0x20BEB1: fbFinishScreenInit (fbscreen.c:229) ==30021== by 0x20C275: fbScreenInit (fbscreen.c:273) ==30021== by 0x1E0317: nxagentOpenScreen (Screen.c:1357) ==30021== by 0x16D848: AddScreen (dispatch.c:4171) ==30021== by 0x1DB7FF: InitOutput (Init.c:396) ==30021== by 0x14DB12: main (main.c:279) ==30021== ==30021== 3,072 (192 direct, 2,880 indirect) bytes in 1 blocks are definitely lost in loss record 290 of 302 ==30021== at 0x483577F: malloc (vg_replace_malloc.c:299) ==30021== by 0x2CCCC7: _gl_context_modes_create (glcontextmodes.c:364) ==30021== by 0x2EF87C: init_visuals (xf86glx.c:381) ==30021== by 0x2EF87C: __MESA_initVisuals (xf86glx.c:541) ==30021== by 0x17C922: GlxInitVisuals (glxext.c:317) ==30021== by 0x218E73: fbInitVisuals (fbcmap.c:668) ==30021== by 0x20BEB1: fbFinishScreenInit (fbscreen.c:229) ==30021== by 0x20C275: fbScreenInit (fbscreen.c:273) ==30021== by 0x1E0317: nxagentOpenScreen (Screen.c:1357) ==30021== by 0x16D848: AddScreen (dispatch.c:4171) ==30021== by 0x1DB7FF: InitOutput (Init.c:396) ==30021== by 0x14DB12: main (main.c:279) The problem here is that GlxInitVisuals is called twice. First via fbScreenInit and then again via nxagentInitGlxExtension. We remove the first one to ensure the code in nxagenOpenScreen works as initially intended. There's an xorg upstream patch that does the same (7d74690536b64f7b8e8036507ab7790807349c50), but it also cleans up other stuff we do not even have in out source (yet?). --- nx-X11/programs/Xserver/mi/miinitext.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'nx-X11/programs/Xserver/mi') diff --git a/nx-X11/programs/Xserver/mi/miinitext.c b/nx-X11/programs/Xserver/mi/miinitext.c index 9e0f82643..319cb1f2d 100644 --- a/nx-X11/programs/Xserver/mi/miinitext.c +++ b/nx-X11/programs/Xserver/mi/miinitext.c @@ -228,7 +228,6 @@ extern void GlxPushProvider(__GLXprovider *impl); */ #ifndef __DARWIN__ extern void GlxExtensionInit(void); -extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); #else extern void DarwinGlxExtensionInit(void); extern void DarwinGlxWrapInitVisuals(miInitVisualsProcPtr *); @@ -474,9 +473,7 @@ InitVisualWrap() { miResetInitVisuals(); #ifdef GLXEXT -#ifndef __DARWIN__ - GlxWrapInitVisuals(&miInitVisualsProc); -#else +#ifdef __DARWIN__ DarwinGlxWrapInitVisuals(&miInitVisualsProc); #endif #endif -- cgit v1.2.3 From c8520ac0aabb475d92ea6b60e3113f2999c04eb8 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 20 Jun 2019 23:14:09 +0200 Subject: mi/miexpose.c: add missing free() --- nx-X11/programs/Xserver/mi/miexpose.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'nx-X11/programs/Xserver/mi') diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index 274a8d4ce..40272f962 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -757,7 +757,10 @@ int what; if (screenContext[i] == (GCPtr)NULL) { if (!ResType && !(ResType = CreateNewResourceType(tossGC))) + { + free(prect); return; + } screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0, (XID *)NULL, &status); if (!screenContext[i]) -- cgit v1.2.3