Another "if it ain't broke, don't fix it" moment. Revert some more

code in _glapi_set_dispatch to its 1.74 form.  This fixes a "problem"
with buggy apps that make GL calls with no bound GL context (i.e.,
Enemy Territory during shut-down).
This commit is contained in:
Ian Romanick
2004-07-05 22:40:54 +00:00
parent 8a08853536
commit 6c5402bccd

View File

@@ -294,24 +294,19 @@ _glapi_get_context(void)
void void
_glapi_set_dispatch(struct _glapi_table *dispatch) _glapi_set_dispatch(struct _glapi_table *dispatch)
{ {
struct _glapi_table * old_style_dispatch; if (!dispatch) {
/* use the no-op functions */
dispatch = (struct _glapi_table *) __glapi_noop_table;
/* Use the no-op functions if a NULL dispatch table was requested. }
*/
old_style_dispatch = (dispatch == NULL)
? (struct _glapi_table *) __glapi_noop_table : dispatch;
#ifdef DEBUG #ifdef DEBUG
if (dispatch != NULL) { else {
_glapi_check_table(dispatch); _glapi_check_table(dispatch);
} }
#endif #endif
#if defined(THREADS) #if defined(THREADS)
if (DispatchOverride) { if (DispatchOverride) {
_glthread_SetTSD(&RealDispatchTSD, (void *) old_style_dispatch); _glthread_SetTSD(&RealDispatchTSD, (void *) dispatch);
if (ThreadSafe) if (ThreadSafe)
_glapi_RealDispatch = (struct _glapi_table*) __glapi_threadsafe_table; _glapi_RealDispatch = (struct _glapi_table*) __glapi_threadsafe_table;
else else
@@ -319,13 +314,13 @@ _glapi_set_dispatch(struct _glapi_table *dispatch)
} }
else { else {
/* normal operation */ /* normal operation */
_glthread_SetTSD(&_gl_DispatchTSD, (void *) old_style_dispatch); _glthread_SetTSD(&_gl_DispatchTSD, (void *) dispatch);
if (ThreadSafe) { if (ThreadSafe) {
_glapi_Dispatch = (struct _glapi_table *) __glapi_threadsafe_table; _glapi_Dispatch = (struct _glapi_table *) __glapi_threadsafe_table;
_glapi_DispatchTSD = NULL; _glapi_DispatchTSD = NULL;
} }
else { else {
_glapi_Dispatch = old_style_dispatch; _glapi_Dispatch = dispatch;
_glapi_DispatchTSD = dispatch; _glapi_DispatchTSD = dispatch;
} }
} }