Closed
Bug 455698
Opened 16 years ago
Closed 16 years ago
Assertion when creating a widget with null parent and null native data
Categories
(Core :: Widget: Cocoa, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: bzbarsky, Assigned: jaas)
References
Details
Attachments
(2 files, 1 obsolete file)
2.22 KB,
patch
|
smichaud
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
53.12 KB,
patch
|
Details | Diff | Splinter Review |
STEPS TO REPRODUCE: Call nsIView::CreateWidget with a null parent widget and null native data. ACTUAL RESULTS: We end up in nsChildView::StandardCreate with a null aParent and a null aNativeParent. Then we hit the following assertion: ###!!! ASSERTION: couldn't hook up new NSView in hierarchy: 'mParentView && mView', file /Users/bzbarsky/mozilla/svg-ext/mozilla/widget/src/cocoa/nsChildView.mm, line 513 because mParentView is null. EXPECTED RESULTS: No assertion, or some way to do what I want to do that doesn't involve passing in all the nulls. What I'm trying to do is to create an nsIWidget that's not hooked up to any existing nsIWidget, or to any existing native widgets. It should just live in a little world of its own. Need this for external reference documents.
Attachment #339816 -
Flags: review?(smichaud)
oops, forgot to regenerate my patch after fixing this
Attachment #339816 -
Attachment is obsolete: true
Attachment #339824 -
Flags: review?(smichaud)
Attachment #339816 -
Flags: review?(smichaud)
Comment 3•16 years ago
|
||
I strongly suspect this won't work, because (in Boris' example) we'd be creating an NSView that doesn't belong to any NSWindow. However, it might be possible to get this idea to work by also changing the following code // Hook it up in the NSView hierarchy. if (mParentView) { NSWindow* window = [mParentView window]; if (!window && [mParentView respondsToSelector:@selector(nativeWindow)]) window = [mParentView nativeWindow]; [mView setNativeWindow:window]; [mParentView addSubview:mView]; } to something like // Hook it up in the NSView hierarchy. if (mParentView) { NSWindow* window = [mParentView window]; if (!window && [mParentView respondsToSelector:@selector(nativeWindow)]) window = [mParentView nativeWindow]; [mView setNativeWindow:window]; [mParentView addSubview:mView]; } else { NSWindow *window = [NSApp keyWindow]; if (!window) window = [NSApp mainWindow]; if (!window) [Complain loudly and abort] [mView setNativeWindow:window]; [[window contentView] addSubview:mView]; }
Comment 4•16 years ago
|
||
Boris, could you create a testcase that shows what you're trying to do (including, if possible, how you're using it to implement external reference documents)? This'll probably make it a lot easier for us to figure out what you need.
Reporter | ||
Comment 5•16 years ago
|
||
Apply this patch (applies cleanly on top of rev dd9e757b2e96) and then recompile. Then load <https://bugzilla.mozilla.org/attachment.cgi?id=335464>. You will get the asserts described in this bug. Note that as far as I can tell everything that I want to work actually works. I just get these asserts.
Comment 6•16 years ago
|
||
Comment on attachment 339824 [details] [diff] [review] fix v1.1 (In reply to comment #5) > Note that as far as I can tell everything that I want to work > actually works. I just get these asserts. That's puzzling. I can't figure out why it would work ... but then again I don't really know what you're trying to do. (Following up comment #3) Josh, I can't find any other problems with your patch than the one I've already mentioned. But it (as Boris seems to say) that's a non-issue, then I'll r+ your patch. However I suspect we may have problems with this down the line. The core issue is that (as far as I know) you can't display the contents of an NSView object without "attaching" it to an NSWindow object (without making it a subview of (say) the NSWindow object's contentView). But maybe Boris isn't trying to display this particular NSView object (the one corresponding to the "nsIWidget that's not hooked up to any existing nsIWidget, or to any existing native widgets").
Attachment #339824 -
Flags: review?(smichaud) → review+
Attachment #339824 -
Flags: superreview?(bzbarsky)
Reporter | ||
Comment 7•16 years ago
|
||
Yeah, I don't need anything out of the widget here. I just want to have the frame tree, which I paint into a totally different native surface.
Reporter | ||
Updated•16 years ago
|
Attachment #339824 -
Flags: superreview?(bzbarsky) → superreview+
landed on trunk
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•