VirtualBox

Ignore:
Timestamp:
Jul 15, 2021 7:45:34 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
145755
Message:

Add/Lnx/VBoxClient/vmsvga: Try avoid closing the same display structure more than once by setting the members to NULL afte closing. Don't call XRRSelectInput with a NULL display pointer. (Background: Saw Ubuntu complaing once about a double free with XCloseDisplay and the signal handler on the stack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp

    r90036 r90218  
    779779    }
    780780
    781 #ifdef WITH_DISTRO_XRAND_XINERAMA
    782     XRRSelectInput(x11Context.pDisplayRandRMonitoring, x11Context.rootWindow, 0);
    783 #else
    784     if (x11Context.pXRRSelectInput)
    785         x11Context.pXRRSelectInput(x11Context.pDisplayRandRMonitoring, x11Context.rootWindow, 0);
    786 #endif
    787 
    788     XCloseDisplay(x11Context.pDisplay);
    789     XCloseDisplay(x11Context.pDisplayRandRMonitoring);
     781    if (x11Context.pDisplayRandRMonitoring)
     782    {
     783#ifdef WITH_DISTRO_XRAND_XINERAMA
     784        XRRSelectInput(x11Context.pDisplayRandRMonitoring, x11Context.rootWindow, 0);
     785#else
     786        if (x11Context.pXRRSelectInput)
     787            x11Context.pXRRSelectInput(x11Context.pDisplayRandRMonitoring, x11Context.rootWindow, 0);
     788#endif
     789    }
     790
     791    if (x11Context.pDisplay)
     792    {
     793        XCloseDisplay(x11Context.pDisplay);
     794        x11Context.pDisplay = NULL;
     795    }
     796
     797    if (x11Context.pDisplayRandRMonitoring)
     798    {
     799        XCloseDisplay(x11Context.pDisplayRandRMonitoring);
     800        x11Context.pDisplayRandRMonitoring = NULL;
     801    }
    790802
    791803    if (x11Context.pRandLibraryHandle)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette