summaryrefslogtreecommitdiff
path: root/src/widget.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-06-20 08:48:14 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-06-20 09:01:43 -0700
commitfb45f7075afa033de27e358739cbda0107af12b2 (patch)
tree010d44c8382fd68eb13ae680d96a3cfa83aba25a /src/widget.c
parent6fcbbc393eced8350f6d4679d8070bfc48244aab (diff)
downloademacs-fb45f7075afa033de27e358739cbda0107af12b2.tar.gz
Fix crash when built by GNU Gold linker on x86
Problem reported by Andrés Musetti (Bug#27248). * src/widget.c (emacsFrameClassRec): Do not initialize superclass here. (emacsFrameClass): Now a function (which initializes the superclass) instead of a variable. All uses changed.
Diffstat (limited to 'src/widget.c')
-rw-r--r--src/widget.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/widget.c b/src/widget.c
index d7ec7028517..585039d58c6 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -108,7 +108,7 @@ emacsFrameTranslations [] = "\
static EmacsFrameClassRec emacsFrameClassRec = {
{ /* core fields */
- /* superclass */ &widgetClassRec,
+ /* superclass */ 0, /* filled in by emacsFrameClass */
/* class_name */ (char *) "EmacsFrame",
/* widget_size */ sizeof (EmacsFrameRec),
/* class_initialize */ 0,
@@ -146,7 +146,16 @@ static EmacsFrameClassRec emacsFrameClassRec = {
}
};
-WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec;
+WidgetClass
+emacsFrameClass (void)
+{
+ /* Set the superclass here rather than relying on static
+ initialization, to work around an unexelf.c bug on x86 platforms
+ that use the GNU Gold linker (Bug#27248). */
+ emacsFrameClassRec.core_class.superclass = &widgetClassRec;
+
+ return (WidgetClass) &emacsFrameClassRec;
+}
static void
get_default_char_pixel_size (EmacsFrame ew, int *pixel_width, int *pixel_height)