Crash in GLGraphicsDriver().SwapSharedContext?

BlitzMax Forums/BlitzMax Programming/Crash in GLGraphicsDriver().SwapSharedContext?

I am getting an occasional crash when I draw an image. I draw a non-Null image, and the crash happens here in glgraphics.bmx:

	Method SwapSharedContext()
		bbGLGraphicsSwapSharedContext
	End Method


Any ideas what might trigger that?

What are you exactly doing, in which way are you using it? Windowed mode, fullscreen mode, MaxGUI with Canvas?

Windowed.

I'd post code, but it's a large project, and I can't post it publicly.

I am using Indiepath's projmatrix, though. Might that be a factor?

I am using Indiepath's projmatrix, though. Might that be a factor?

Does it happen if you don't use it?
How often does the problem occur (e.g. every xth drawimage, every y mins of running etc).
Is this a problem which always occurred in the program or something which started after some changes?

I haven't tried taking the projmatrix out. I'll give that a shot tomorrow.

The problem seems to occur completely randomly. Sometimes it happens immediately after running the program, sometimes it happens five or ten minutes in, and often it never happens at all.

And it's fairly new... I'd say since 1.24 came out.

There have indeed been many changes to the project, but all on the order of just drawing more stuff. Nothing fundamental to the graphics. I'm mostly using vanilla 2d graphics.

Basically, if anyone has any insight into what might cause a crash in that method, that might help me backtrack to find the error. Right now, it's just baffling, because the call stack looks clean; it just errors out on that method.

I could really use more help with this... I realize the info I provide is pretty limited, but any insights would help.

The crash happens with projmatrix and without. It happens more frequently in higher resolutions. It also happens more frequently when not running in the IDE.

The error can happens from DrawText, DrawImage, GrabPixmap... basically, just about anything that interacts with the screen, it seems.

The specific debug info provided by the debugger in BLide is below. As you can see, I seem to be hitting a Null value deep in the function.

@$BMXPATH/mod/brl.mod/glgraphics.mod/glgraphics.bmx
Function SwapSharedContext
    Type TDataType
    Field _succ:TDataType=$00ee0ce0
        Type TDataType
        Field _succ:TDataType=$$00eeb30
            Type TDataType
            Field _succ:TDataType=$00ee0ae0
                Type TDataType
                Field _succ:TDataType=$00ee0ab0
                    Type TDataType
                    Field _succ:TDataType=Null
                    Type TPixmapDataType
                TypeTBankDataType
            Type TListDataType
        Type TImageDataType
    Type TGraphicsDriver
    Type TGLGraphicsDriver


The details vary slightly when the crash is in DrawText versus DrawImage, and so on, but it always looks like this.