diff options
| author | Alan Third | 2023-04-27 20:08:23 +0100 |
|---|---|---|
| committer | Alan Third | 2023-05-07 23:52:46 +0100 |
| commit | 3adc1e7f37901235bda83ea65a90644b7b0a8dbf (patch) | |
| tree | a476d64523d63f2c82f746cf0d45befa34f0e5e4 /src | |
| parent | d5ab8b6f2459b0c0111edc1ac7da20e1452c1f33 (diff) | |
| download | emacs-3adc1e7f37901235bda83ea65a90644b7b0a8dbf.tar.gz emacs-3adc1e7f37901235bda83ea65a90644b7b0a8dbf.zip | |
Fix crash when creating a child frame in NS (bug#63107)
* src/nsterm.m ([EmacsView initFrameFromEmacs:]): Have a second go at
creating the toolbar.
([EmacsWindow createToolbar:]): If there is already a toolbar or the
EmacsView's layer is not an EmacsLayer, then do nothing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index ecbf80ff72d..b9e3cbf81a1 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -7930,6 +7930,10 @@ ns_in_echo_area (void) | |||
| 7930 | [self setLayerContentsRedrawPolicy: | 7930 | [self setLayerContentsRedrawPolicy: |
| 7931 | NSViewLayerContentsRedrawOnSetNeedsDisplay]; | 7931 | NSViewLayerContentsRedrawOnSetNeedsDisplay]; |
| 7932 | [self setLayerContentsPlacement:NSViewLayerContentsPlacementTopLeft]; | 7932 | [self setLayerContentsPlacement:NSViewLayerContentsPlacementTopLeft]; |
| 7933 | |||
| 7934 | /* initWithEmacsFrame can't create the toolbar before the layer is | ||
| 7935 | set, so have another go at creating the toolbar here. */ | ||
| 7936 | [(EmacsWindow*)[self window] createToolbar:f]; | ||
| 7933 | #endif | 7937 | #endif |
| 7934 | 7938 | ||
| 7935 | if (ns_drag_types) | 7939 | if (ns_drag_types) |
| @@ -9174,11 +9178,18 @@ ns_in_echo_area (void) | |||
| 9174 | 9178 | ||
| 9175 | - (void)createToolbar: (struct frame *)f | 9179 | - (void)createToolbar: (struct frame *)f |
| 9176 | { | 9180 | { |
| 9177 | if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f)) | 9181 | if (FRAME_UNDECORATED (f) || !FRAME_EXTERNAL_TOOL_BAR (f) || [self toolbar] != nil) |
| 9178 | return; | 9182 | return; |
| 9179 | 9183 | ||
| 9180 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); | 9184 | EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); |
| 9181 | 9185 | ||
| 9186 | #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 | ||
| 9187 | /* If the view's layer isn't an EmacsLayer then we can't create the | ||
| 9188 | toolbar yet. */ | ||
| 9189 | if (! [[view layer] isKindOfClass:[EmacsLayer class]]) | ||
| 9190 | return; | ||
| 9191 | #endif | ||
| 9192 | |||
| 9182 | EmacsToolbar *toolbar = [[EmacsToolbar alloc] | 9193 | EmacsToolbar *toolbar = [[EmacsToolbar alloc] |
| 9183 | initForView:view | 9194 | initForView:view |
| 9184 | withIdentifier:[NSString stringWithFormat:@"%p", f]]; | 9195 | withIdentifier:[NSString stringWithFormat:@"%p", f]]; |