[vtkusers] Mac OS X x86_64 with Qt-4.5.x,vtk-5.3.x

Chris Kees christopher.e.kees at usace.army.mil
Tue Nov 18 16:04:39 EST 2008


The compiler seemed happy with the syntax, but I still get a segmentation
fault. I tried a couple of random permutations of the code below.


void vtkCocoaRenderWindow::SetWindowInfo(char* info)
    {
      //long tmp;
      
      //sscanf(info,"%ld",&tmp);
      int tmp;
      sscanf(info, "%i", &tmp);
      NSMutableDictionary * manager =
        reinterpret_cast<NSMutableDictionary *>(this->GetCocoaManager());
      [manager setObject:reinterpret_cast<id>(tmp)
         forKey:@"DisplayId"];
      //[manager setObject:reinterpret_cast<id>(tmp)
      // forKey:@"WindowId"];
      //[manager setObject:reinterpret_cast<id>(info)
      // forKey:@"DisplayId"];
      //[manager setObject:reinterpret_cast<id>(info)
      // forKey:@"WindowId"];
      vtkWarningMacro("Method not implemented.");
    }


On 11/18/08 2:01 PM, "Clinton Stimpson" <clinton at elemtech.com> wrote:

> 
> You could try implementing vtkCocoaRenderWindow::SetWindowInfo to
> something like this:
> 
>   int tmp;
>   sscanf(info "%i", &tmp);
>     NSMutableDictionary* manager =
>       reinterpret_cast<NSMutableDictionary *>(this->GetCocoaManager());
>     [manager setObject:reinterpret_cast<id>(tmp)
>                 forKey:@"DisplayId"];
> 
> I don't know if that sscanf thing is the right syntax for Obj-C.
> 
> Clint
> 
> Chris Kees wrote:
>> Clint,
>> 
>> Thanks, I do get that warning. I put in a print statement and it looks like
>> the info variable has an int:
>> 
>> 4781804720
>> Warning: In VTK/Rendering/vtkCocoaRenderWindow.h, line 132
>> vtkCocoaRenderWindow (0x11d0490c0): Method not implemented.
>> 
>> 
>> 
>> On 11/18/08 1:14 PM, "Clinton Stimpson" <clinton at elemtech.com> wrote:
>> 
>>   
>>> I wonder if implementing vtkCocoaRenderWindow::SetWindowInfo() would fix
>>> your problem.  Did you get a warning about it not being implemented in
>>> your console?
>>> 
>>> Clint
>>> 
>>> Chris Kees wrote:
>>>     
>>>> Hi,
>>>> 
>>>> Yesterday I compiled the cvs head of vtk with the development snapshot
>>>> of Qt-4.5 following some of the recent posts on running in 64-bit with
>>>> Cocoa.  If I set useMainWindow=False then the code below runs fine,
>>>> otherwise I get an EXC_BAD_ACCESS signal when I call mainWindow.show()
>>>> (output from gdb is below). Has anybody been able to add the vtk
>>>> widget to a QFrame yet? I'm new to GUI programming, and I'm not sure I
>>>> follow everything covered in the previous posts.  There is a comment
>>>> in the QVTKRenderWindow documentation about need to call
>>>> SetDisplayId() and SetWindowId() in certain situations, but I don't
>>>> know how to call those. Thanks for any suggestions.
>>>> 
>>>> Chris
>>>> 
>>>>         if useMainWindow:
>>>>             #Qt widgets
>>>>             self.frameWidget = QtGui.QFrame(g.mainWindow)
>>>>             self.hbox = QtGui.QHBoxLayout()
>>>>             self.iren = QVTKRenderWindowInteractor(self.frameWidget)
>>>>             
>>>> self.iren.SetInteractorStyle(vtkInteractorStyleTrackballCamera())
>>>>             self.iren.Initialize()
>>>>             self.renWin = self.iren.GetRenderWindow()
>>>>             self.renWin.SetWindowName(name)
>>>>             self.hbox.addWidget(self.iren)
>>>>             self.frameWidget.setLayout(self.hbox)
>>>>             g.tabWidget.addTab(self.frameWidget,title)
>>>>             screen = QtGui.QDesktopWidget().screenGeometry()
>>>>             size = g.mainWindow.geometry()
>>>>             (x,y) = (screen.width()-comm.size()*size.width())/2,
>>>> (screen.height()-size.height())/2
>>>>             g.mainWindow.move(x+comm.rank()*size.width(),y)
>>>>             g.mainWindow.show()
>>>>         else:
>>>>             self.iren = QVTKRenderWindowInteractor()
>>>>             
>>>> self.iren.SetInteractorStyle(vtkInteractorStyleTrackballCamera())
>>>>             self.iren.Initialize()
>>>>             self.renWin = self.iren.GetRenderWindow()
>>>>             self.renWin.SetWindowName(name)
>>>> 
>>>> 
>>>> Program received signal EXC_BAD_ACCESS, Could not access memory.
>>>> Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000018
>>>> 0x0000000109de35c8 in QPaintEngine::setSystemClip ()
>>>> (gdb) back
>>>> #0  0x0000000109de35c8 in QPaintEngine::setSystemClip ()
>>>> #1  0x0000000109ccb60d in -[QCocoaView drawRect:] ()
>>>> #2  0x00007fff83e1c7ab in -[NSView _drawRect:clip:] ()
>>>> #3  0x00007fff83e1b291 in -[NSView
>>>> _recursiveDisplayAllDirtyWithLockFocus:visRec
>>>> t:] ()
>>>> #4  0x00007fff83e1b65e in -[NSView
>>>> _recursiveDisplayAllDirtyWithLockFocus:visRec
>>>> t:] ()
>>>> #5  0x00007fff83e1b65e in -[NSView
>>>> _recursiveDisplayAllDirtyWithLockFocus:visRec
>>>> t:] ()
>>>> #6  0x00007fff83e1b65e in -[NSView
>>>> _recursiveDisplayAllDirtyWithLockFocus:visRec
>>>> t:] ()
>>>> #7  0x00007fff83e1b65e in -[NSView
>>>> _recursiveDisplayAllDirtyWithLockFocus:visRec
>>>> t:] ()
>>>> #8  0x00007fff83e1b65e in -[NSView
>>>> _recursiveDisplayAllDirtyWithLockFocus:visRec
>>>> t:] ()
>>>> #9  0x00007fff83e1b65e in -[NSView
>>>> _recursiveDisplayAllDirtyWithLockFocus:visRec
>>>> t:] ()
>>>> #10 0x00007fff83e199be in -[NSView
>>>> _recursiveDisplayRectIfNeededIgnoringOpacity:
>>>> isVisibleRect:rectIsVisibleRectForView:topView:] ()
>>>> #11 0x00007fff83e19220 in -[NSThemeFrame
>>>> _recursiveDisplayRectIfNeededIgnoringOp
>>>> acity:isVisibleRect:rectIsVisibleRectForView:topView:] ()
>>>> #12 0x00007fff83e15a86 in -[NSView
>>>> _displayRectIgnoringOpacity:isVisibleRect:rec
>>>> tIsVisibleRectForView:] ()
>>>> #13 0x00007fff83d533cb in -[NSView displayIfNeeded] ()
>>>> #14 0x00007fff83d52ec0 in -[NSWindow displayIfNeeded] ()
>>>> #15 0x00007fff83e11be8 in -[NSWindow
>>>> _reallyDoOrderWindow:relativeTo:findKey:for
>>>> Counter:force:isModal:] ()
>>>> #16 0x00007fff83e115e8 in -[NSWindow orderWindow:relativeTo:] ()
>>>> #17 0x00007fff83dd8e94 in -[NSWindow makeKeyAndOrderFront:] ()
>>>> #18 0x0000000109cc2b3b in QWidgetPrivate::show_sys ()
>>>> #19 0x0000000109d5bbee in QWidgetPrivate::show_helper ()
>>>> #20 0x0000000109d5c24c in QWidget::setVisible ()
>>>> #21 0x0000000109594e0e in sipQMainWindow::setVisible ()
>>>> #22 0x0000000109746409 in meth_QWidget_show ()
>>>> 
>>>> _______________________________________________
>>>> This is the private VTK discussion list.
>>>> Please keep messages on-topic. Check the FAQ at:
>>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>       
>>> _______________________________________________
>>> This is the private VTK discussion list.
>>> Please keep messages on-topic. Check the FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>     
>> 
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>   
> 
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list