Re: [gtk-osx-users] crash on updateTrackingRect is BAAACK





On Nov 19, 2020, at 1:41 PM, Allin Cottrell <cottrell wfu edu> wrote:

On Tue, 17 Nov 2020, John Ralls wrote:

On Nov 17, 2020, at 12:53 PM, Allin Cottrell <cottrell wfu edu> wrote:

I just tested full-screening and red button closing GnuCash built yesterday with Gtk+-3.24.23 on macOS 
11 and run with MallocScribble=1 to make sure that a use-after-free would crash. It closed cleanly, no 
crash. You might diff GtkNSWindow.c between Gtk2 and Gtk3 to see if there's something helpful there.

GtkNSWindow.c ? I'm not seeing a file of that name (or close) in the GTK 2 codebase.

Sorry, gdk/quartz/GdkQuartzWindow.c.

Thanks, I see now: it's GdkQuartzWindow.c in Gtk2 and GdkQuartzNSWindow.c in Gtk3. Looks like there are 
several updates for recent macOS in the latter, and backporting such changes to Gtk2 might be useful for 
retrogrades such as myself.

One question. There's a trope that appears in several places in the Gtk2 version:

 GdkWindow *window = [[self contentView] gdkWindow];
 GdkWindowObject *private = (GdkWindowObject *)window;
 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);

while in the Gtk3 version, in the corresponding places, we find:

 GdkWindow *window = [[self contentView] gdkWindow];
 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);

Is this difference cosmetic, or is the intervening cast from *gdkWindow to *GdkWindowObject really required 
in the Gtk2 case?

It's required in Gtk2 because there GdkWindow is a typedef of struct _GdkDrawable, which contains only an 
instance of its parent class--in the case of GdkWindow that would be a GdkWindowObject. Without it the 
compiler would look at struct _GdkDrawable for a member impl and fail to find it; with the cast it looks in 
struct _GtkWindowObject instead where it does find it.

That indirection was removed from Gtk3 so no more cast. There are lots of other changes in Gtk3, particularly 
in the last couple of years as the architecture changed to ease migration to Gtk4. Quartz hasn't kept up with 
all of it but you'll still need to spend significant time learning the internals and differences to 
successfully backport.

Regards,
John Ralls



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]