VirtualBox

Ignore:
Timestamp:
Dec 2, 2011 7:44:16 AM (13 years ago)
Author:
vboxsync
Message:

crOpenGL: fix destroyed context refference in TLS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h

    r37613 r39507  
    118118struct CRContext {
    119119    int id;
     120
     121#ifdef CHROMIUM_THREADSAFE
     122    /* we keep reference counting of context's makeCurrent for different threads
     123     * this is primarily needed to avoid having an invalid memory reference in the TLS
     124     * when the context is assigned to more than one threads and then destroyed from
     125     * one of those, i.e.
     126     * 1. Thread1 -> MakeCurrent(ctx1);
     127     * 2. Thread2 -> MakeCurrent(ctx1);
     128     * 3. Thread1 -> Destroy(ctx1);
     129     * => Thread2 still refers to destroyed ctx1
     130     * */
     131    /* number of threads that have context set as current */
     132    volatile int cRefs;
     133#endif
     134
    120135    CRbitvalue bitid[CR_MAX_BITARRAY];
    121136    CRbitvalue neg_bitid[CR_MAX_BITARRAY];
     
    181196DECLEXPORT(void) crStateInit(void);
    182197DECLEXPORT(void) crStateDestroy(void);
     198DECLEXPORT(void) crStateOnThreadAttachDetach(GLboolean attach);
    183199DECLEXPORT(CRContext *) crStateCreateContext(const CRLimitsState *limits, GLint visBits, CRContext *share);
    184200DECLEXPORT(CRContext *) crStateCreateContextEx(const CRLimitsState *limits, GLint visBits, CRContext *share, GLint presetID);
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