Control: tag -1 + patch

On Wed, 2013-04-03 at 21:12:00 +0200, Philipp Kern wrote:
> Control: tag -1 moreinfo

> On Wed, Apr 03, 2013 at 09:02:56PM +0200, Lucio Crusca wrote:
> > $ openclonk 
> > [20:59:28] Using XRandR version 1.3
> > [20:59:28] Command line: openclonk
> > [20:59:28] OpenClonk Beyond the Rocks Delta
> > [20:59:28] Version: 5.3.3 [025] Delta linux-x86_64 (b78664b43cae)
> > The program 'openclonk' received an X Window System error.
> > This probably reflects a bug in the program.
> > The error was 'BadRROutput (invalid Output parameter)'.
> >   (Details: serial 262 error_code 182 request_code 157 minor_code 9)
> >   (Note to programmers: normally, X errors are reported asynchronously;
> >    that is, you will receive the error a while after causing it.
> >    To debug your program, run it with the --sync command line
> >    option to change this behavior. You can then get a meaningful
> >    backtrace from your debugger if you break on the gdk_x_error() function.)
> > 5.3.3 [025] Delta: Caught signal SIGSEGV
> > openclonk(+0x1b4504)[0x7f12a5b84504]
> > /lib/x86_64-linux-gnu/libpthread.so.0(+0xf030)[0x7f12a13af030]
> > /usr/lib/x86_64-linux-gnu/libX11.so.6(XQueryExtension+0x28)[0x7f12a3e62fc8]
> > /usr/lib/x86_64-linux-gnu/libX11.so.6(XInitExtension+0x25)[0x7f12a3e57055]
> > /usr/lib/x86_64-linux-gnu/libXext.so.6(XextAddDisplay+0x4b)[0x7f12a3c1eb8b]
> > /usr/lib/x86_64-linux-gnu/libGL.so.1(+0x3efd9)[0x7f12a45cefd9]
> > /usr/lib/x86_64-linux-gnu/libGL.so.1(+0x336e2)[0x7f12a45c36e2]
> 
> what graphics driver do you use? Can you try »openclonk --nofullscreen«?
> 
> It is *probably* more useful to directly contact the developers on [1] with as
> much detail about your configuration as possible, but if that's not an option 
> I
> can play man-in-the-middle for this.

Changing from fullscreen to windowed mode didn't appear to make any
difference, also to do that I had to edit the config file (Windowed
variable).

In any case, I've tracked this down, and the attached patch works for
me, at least for the XRandR issue (the game starts again), as I'm not
seeing any segfaults on startup.

I've tried to preserve the coding style of the overall file, not just
that function (re spaces after keywords), as it's not entirely
consistent.

Thanks,
Guillem
--- a/src/platform/C4AppGTK.cpp
+++ b/src/platform/C4AppGTK.cpp
@@ -212,20 +212,25 @@ static XRROutputInfo* GetXRROutputInfoFo
 	XRRScreenResources * r = XRRGetScreenResources(dpy, w);
 	if (!r) return NULL;
 
-	XRROutputInfo * info = XRRGetOutputInfo(dpy, r, XRRGetOutputPrimary(dpy, w));
-	if (!info)
+	XRROutputInfo * info;
+	RROutput primary = XRRGetOutputPrimary(dpy, w);
+	if (primary == None)
+		info = NULL;
+	else
 	{
-		XRRFreeScreenResources(r);
-		return NULL;
+		info = XRRGetOutputInfo(dpy, r, primary);
+		if (info->connection == RR_Disconnected || info->crtc == 0)
+		{
+			XRRFreeOutputInfo(info);
+			info = NULL;
+		}
 	}
 
-	if(info->connection == RR_Disconnected || info->crtc == 0)
+	if (info == NULL)
 	{
 		// The default "primary" output does not seem to be connected
 		// to a piece of actual hardware. As a fallback, go through
 		// all outputs and choose the first active one.
-		XRRFreeOutputInfo(info);
-		info = NULL;
 		for(int i = 0; i < r->noutput; ++i)
 		{
 			info = XRRGetOutputInfo(dpy, r, r->outputs[i]);

Reply via email to