After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 781118 - gtk 3.22.12 quartz backend segfault
gtk 3.22.12 quartz backend segfault
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Quartz
3.22.x
Other Mac OS
: Normal critical
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-04-10 08:07 UTC by Tom Schoonjans
Modified: 2017-05-15 14:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot demonstrating big text (1.23 MB, image/png)
2017-04-12 11:54 UTC, Tom Schoonjans
Details
Screenshot demonstrating how it was (and should still be?) (922.80 KB, image/png)
2017-04-12 13:42 UTC, Tom Schoonjans
Details
Showing gtk3-demo before and after the patch. (370.15 KB, image/png)
2017-04-13 19:01 UTC, John Ralls
Details
Gtk3-demo on a retina MacBookPro (429.34 KB, image/png)
2017-04-16 21:28 UTC, John Ralls
Details

Description Tom Schoonjans 2017-04-10 08:07:54 UTC
The recently released gtk 3.22.12 produces a malfunctioning quartz backend, probably due to commit b6aaae7dea8e574f3e8da1e2a25997ea3d10f05e

This is the backtrace, generated by every gtk+3 dependent app:

2017-04-09 14:10:16.291 gtk3-widget-factory[57635:5002753] -[NSConcreteValue width]: unrecognized selector sent to instance 0x7fe251c2e700
2017-04-09 14:10:16.292 gtk3-widget-factory[57635:5002753] An uncaught exception was raised
2017-04-09 14:10:16.292 gtk3-widget-factory[57635:5002753] -[NSConcreteValue width]: unrecognized selector sent to instance 0x7fe251c2e700
2017-04-09 14:10:16.292 gtk3-widget-factory[57635:5002753] (
	0   CoreFoundation                      0x00007fff83574452 __exceptionPreprocess + 178
	1   libobjc.A.dylib                     0x00007fff84fccf7e objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff835de10d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
	3   CoreFoundation                      0x00007fff834e44d1 ___forwarding___ + 1009
	4   CoreFoundation                      0x00007fff834e4058 _CF_forwarding_prep_0 + 120
	5   libgdk-3.0.dylib                    0x00000001053d240d gdk_quartz_screen_init + 98
	6   libgobject-2.0.0.dylib              0x0000000105eb99ea g_type_create_instance + 659
	7   libgobject-2.0.0.dylib              0x0000000105ea981c g_object_new_internal + 52
	8   libgobject-2.0.0.dylib              0x0000000105ea92a8 g_object_newv + 496
	9   libgobject-2.0.0.dylib              0x0000000105ea9081 g_object_new + 201
	10  libgdk-3.0.dylib                    0x00000001053cccd5 _gdk_quartz_display_open + 129
	11  libgdk-3.0.dylib                    0x00000001053aa2cc gdk_display_manager_open_display + 456
	12  libgtk-3.0.dylib                    0x00000001055b40f0 gtk_init_check + 19
	13  libgtk-3.0.dylib                    0x00000001055b4125 gtk_init + 13
	14  libgtk-3.0.dylib                    0x00000001054afc75 gtk_application_startup + 63
	15  libgobject-2.0.0.dylib              0x0000000105ea3c09 g_closure_invoke + 260
	16  libgobject-2.0.0.dylib              0x0000000105eb6e1f signal_emit_unlocked_R + 1239
	17  libgobject-2.0.0.dylib              0x0000000105eb7cd4 g_signal_emit_valist + 1889
	18  libgobject-2.0.0.dylib              0x0000000105eb8342 g_signal_emit + 142
	19  libgio-2.0.0.dylib                  0x0000000105d93b6d g_application_register + 216
	20  libgio-2.0.0.dylib                  0x0000000105d9538e g_application_real_local_command_line + 1071
	21  libgio-2.0.0.dylib                  0x0000000105d940d3 g_application_run + 305
	22  gtk3-widget-factory                 0x000000010536bc8d main + 195
	23  libdyld.dylib                       0x00007fff890625ad start + 1
)
2017-04-09 14:10:16.293 gtk3-widget-factory[57635:5002753] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteValue width]: unrecognized selector sent to instance 0x7fe251c2e700'

I noticed this bug initially on my own El Capitan system, but after submitting the update to Homebrew, it turns out to the present on Sierra and Yosemite too:

https://github.com/Homebrew/homebrew-core/pull/12253
Comment 1 John Ralls 2017-04-10 23:40:44 UTC
I've pushed a fix to 3-22. I'll cherry-pick it to master later.
Comment 2 Matthias Clasen 2017-04-11 01:40:03 UTC
thanks
Comment 3 Tom Schoonjans 2017-04-11 05:32:30 UTC
many thanks!
Comment 4 Tom Schoonjans 2017-04-12 11:53:53 UTC
After applying this patch to gtk 3.22.12 all text has become really big. I am attaching a screenshot
Comment 5 Tom Schoonjans 2017-04-12 11:54:49 UTC
Created attachment 349718 [details]
Screenshot demonstrating big text
Comment 6 John Ralls 2017-04-12 13:35:53 UTC
Your screen-shot doesn't really show anything out of the ordinary; perhaps if you include some other application's window in the shot?

Why did you backport it to 3.22.12 instead of compiling and testing gtk-3-22 HEAD?
Comment 7 Tom Schoonjans 2017-04-12 13:41:13 UTC
Attaching a screenshot of the way it looked before.

I was trying to update the gtk+3 Homebrew formula for 3.22.12, as I figured that applying your patch would be sufficient to get that release working properly.
Comment 8 Tom Schoonjans 2017-04-12 13:42:20 UTC
Created attachment 349731 [details]
Screenshot demonstrating how it was (and should still be?)
Comment 9 John Ralls 2017-04-13 19:01:42 UTC
Created attachment 349835 [details]
Showing gtk3-demo before and after the patch.

I don't see anything like such a dramatic difference. I've attached a screenshot showing the two side-by-side; the left view is compiled from 8074626fc, immediately before changing the resolution settings and the right image from gtk-3-22 HEAD, after fixing the resolution setting. Xcode 8.2, MacOS 10.12.3, late 2013 Mac Pro, 1920x1080 monitor. There's no apparent difference on the 2560x1440 monitor.

Note that that's not a retina display and that I don't have one to test with.
Comment 10 Tom Schoonjans 2017-04-14 08:14:08 UTC
The screenshots I uploaded were indeed made on an iMac with retina display. In my case the difference is dramatic: it looks like it went into vision impaired mode.

This is already apparent by looking at the difference in file size and image dimensions (taking into account I did not manually resize the window): both parameters blow up with the latest gtk 3.22.12 release.

I am wondering why you didn't replace userSpaceScaleFactor by 1, as explained in https://bugzilla.gnome.org/show_bug.cgi?id=765883. This would have continued to provide proper support for retina and non-retina screens, while getting rid of the deprecation warning.
Comment 11 John Ralls 2017-04-14 13:50:21 UTC
I'd forgotten about bug 765883. (BTW you don't need to copy the URI for bugs unless they're from a different bug tracker.) There was another discussion somewhere (sorry, don't remember where and I can't find it) pointing out that hardcoding the pixels isn't the right thing to do, we should be asking the display for its resolution and using that. That's very much the advertised intent of "get_mm_from_pixels" and that's exactly what my change does. That it causes text (and only text!) to blow up on HiDPI suggests that fixing this has exposed problems elsewhere.
Comment 12 Tom Schoonjans 2017-04-16 10:10:37 UTC
Fair enough.

Until the underlying cause of the text blowing up is found, would it be possible to revert b6aaae7dea8e574f3e8da1e2a25997ea3d10f05e for the next gtk+3 bug fix release? Same request for gtk+4 if it would have been cherrypicked into master.

Thanks
Comment 13 John Ralls 2017-04-16 21:28:50 UTC
Created attachment 349915 [details]
Gtk3-demo on a retina MacBookPro

So I borrowed a retina MBP, bundled up gtk3-demo and copied it over, and as you can see it looks fine.

I can't find anything that looks like your example in gtk3-demo. What are you using? Does gtk3-demo look similarly borked on your system? What MacOS version?
Comment 14 Tom Schoonjans 2017-04-18 07:41:09 UTC
I disagree that it looks fine. The grainy nature of gtk3-demo compared to the smooth appearance of the text app points to something being wrong with the retina support. 

Apart from the text blowing up on my machine, I do get the smooth appearance, and I believe it has always been there for gtk+3 with quartz backend.
Comment 15 Tom Schoonjans 2017-04-18 08:10:40 UTC
Oh and I am using gtk3-widget-factory instead of gtk3-demo, which indeed looks equally blown up...
Comment 16 Dustin Spicuzza 2017-05-15 02:39:30 UTC
I can report that the text is incredibly large now on 3.22.15. :(
Comment 17 Dustin Spicuzza 2017-05-15 02:43:06 UTC
Note that I'm on a MacBook Pro (Retina, 15-inch, Mid 2015) running 10.12.4
Comment 18 Tom Schoonjans 2017-05-15 13:09:54 UTC
I use the following patch to get 3.12.15 working properly:

diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index 586f7af..d032643 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -79,7 +79,7 @@ gdk_quartz_screen_init (GdkQuartzScreen *quartz_screen)
   NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
   NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];

-  _gdk_screen_set_resolution (screen, size.width);
+  _gdk_screen_set_resolution (screen, 72.0);

   gdk_quartz_screen_calculate_layout (quartz_screen);

@@ -334,11 +334,8 @@ gdk_quartz_screen_get_height (GdkScreen *screen)
 static gint
 get_mm_from_pixels (NSScreen *screen, int pixels)
 {
-  const float mm_per_inch = 25.4;
-  NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
-  NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];
-  float dpi = size.width;
-  return (pixels / dpi) * mm_per_inch;
+  const float dpi = 72.0;
+  return (pixels / dpi) * 25.4;
 }

 static gchar *
Comment 19 John Ralls 2017-05-15 14:05:15 UTC
Christoph opened bug 782393 to address directly the font-size issue, so let's please continue the discussion there.

I'm re-resolving this as the original problem, the crash, is fixed.