[Paraview-developers] How to get active session from a plugin ?

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Aug 6 17:56:45 EDT 2015


Is the goal to get all the proxy that compose the pipeline browser?


On Thu, Aug 6, 2015 at 3:48 PM, houssen <houssen at ipgp.fr> wrote:

> Here is a code snippet from myExporter.cpp : crash occurs at line 125
> (according to stack below)
> 105   vtkSMProxyManager * pProxyMgr = vtkSMProxyManager::GetProxyManager
> ();
> 106   if ( pProxyMgr )
> 107   {
> 108     vtkSMSession * pSession = pProxyMgr -> GetActiveSession ();
> 109     if ( pSession )
> 110     {
> 111       msg << "\n get session";
> 112       vtkSMSessionProxyManager * pProxyMgr = pSession ->
> GetSessionProxyManager ();
> 113       if ( pProxyMgr )
> 114       {
> 115         msg << "\n get proxy mgr";
> 116         vtkSmartPointer<vtkSMProxyIterator> spProxyIterator =
> vtkSmartPointer<vtkSMProxyIterator>::New();
> 117         spProxyIterator -> SetSessionProxyManager ( pProxyMgr );
> 118         spProxyIterator -> SetSession ( pSession );
> 119         spProxyIterator -> Begin ();
> 120         vtkSMProxy * pProxy = spProxyIterator -> GetProxy();
> 121         msg << "\nProxy : " << pProxy -> GetClassName ();
> 122         while ( pProxy )
> 123         {
> 124           vtkObjectBase * pObj = pProxy -> GetClientSideObject ();
> 125           msg << "\n  Proxy client obj : " << pObj -> GetClassName ();
> 126
> 127           spProxyIterator -> Next ();
> 128           pProxy = spProxyIterator -> GetProxy();
> 129         }
> 130       }
> 131     }
> 133   }
>
> I tried to use GetClientSideObject as I believe it could be a way to
> finally scan the pipeline browser. I would like to access each pipeline of
> the pipeline browser from an exporter.
>
> Franck
>
>
> Le 2015-08-06 23:34, houssen a écrit :
>
>> I get this :
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x00007ffff1e3db76 in vtkObjectBase::GetClassName (this=0x0) at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/VTK/Common/Core/vtkObjectBase.cxx:112
>> 112       return this->GetClassNameInternal();
>> (gdb) l
>> 107       return this->GetClassNameInternal();
>> 108     }
>> 109     #endif
>> 110     const char* vtkObjectBase::GetClassName() const
>> 111     {
>> 112       return this->GetClassNameInternal();
>> 113     }
>> 114
>> 115     int vtkObjectBase::IsTypeOf(const char *name)
>> 116     {
>> (gdb) bt
>> #0  0x00007ffff1e3db76 in vtkObjectBase::GetClassName (this=0x0) at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/VTK/Common/Core/vtkObjectBase.cxx:112
>> #1  0x00007fffc07f0fb4 in slvPrvExporter::WriteData (this=0x57be820)
>> at /mnt/users/houssen/Documents/myExporter/myExporter.cpp:125
>> #2  0x00007fffd1db7971 in vtkExporter::Write (this=0x57be820) at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/VTK/IO/Export/vtkExporter.cxx:65
>> #3  0x00007ffff493bab2 in vtkSMRenderViewExporterProxy::Write
>> (this=0x4e621f0)
>>     at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/ParaViewCore/ServerManager/Default/vtkSMRenderViewExporterProxy.cxx:58
>> #4  0x00007ffff7af57c5 in pqExportReaction::exportActiveView
>> (this=0xa9d0e0)
>>     at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/Qt/ApplicationComponents/pqExportReaction.cxx:170
>> #5  0x00007ffff7b56b1c in pqExportReaction::onTriggered (this=0xa9d0e0)
>>     at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/BUILD/Qt/ApplicationComponents/../../../Qt/ApplicationComponents/pqExportReaction.h:59
>> #6  0x00007ffff7b5abc6 in pqReaction::qt_static_metacall
>> (_o=0xa9d0e0, _c=QMetaObject::InvokeMetaMethod, _id=0,
>> _a=0x7fffffffd120)
>>     at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/BUILD/Qt/ApplicationComponents/moc_pqReaction.cxx:51
>> #7  0x00007ffff581087a in QMetaObject::activate
>> (sender=sender at entry=0xa945d0, m=m at entry=0x7ffff67d7de0
>> <QAction::staticMetaObject>,
>>     local_signal_index=local_signal_index at entry=1,
>> argv=argv at entry=0x7fffffffd120) at kernel/qobject.cpp:3539
>> #8  0x00007ffff5d27a62 in QAction::triggered
>> (this=this at entry=0xa945d0, _t1=false) at
>> .moc/release-shared/moc_qaction.cpp:276
>> #9  0x00007ffff5d29433 in QAction::activate
>> (this=this at entry=0xa945d0, event=event at entry=QAction::Trigger) at
>> kernel/qaction.cpp:1257
>> #10 0x00007ffff6157509 in QMenuPrivate::activateCausedStack
>> (this=this at entry=0x86c610, causedStack=...,
>> action=action at entry=0xa945d0,
>>     action_e=action_e at entry=QAction::Trigger, self=self at entry=true)
>> at widgets/qmenu.cpp:1038
>> #11 0x00007ffff615ba39 in QMenuPrivate::activateAction
>> (this=0x86c610, action=0xa945d0, action_e=QAction::Trigger,
>> self=<optimized out>) at widgets/qmenu.cpp:1130
>> #12 0x00007ffff5d7d51a in QWidget::event (this=this at entry=0x8fa300,
>> event=event at entry=0x7fffffffd720) at kernel/qwidget.cpp:8376
>> #13 0x00007ffff615f83b in QMenu::event (this=0x8fa300,
>> e=0x7fffffffd720) at widgets/qmenu.cpp:2481
>> #14 0x00007ffff5d2de2c in QApplicationPrivate::notify_helper
>> (this=this at entry=0x6faae0, receiver=receiver at entry=0x8fa300,
>> e=e at entry=0x7fffffffd720)
>>     at kernel/qapplication.cpp:4567
>> #15 0x00007ffff5d345dd in QApplication::notify (this=<optimized out>,
>> receiver=0x8fa300, e=0x7fffffffd720) at kernel/qapplication.cpp:4110
>> #16 0x00007ffff57fc4dd in QCoreApplication::notifyInternal
>> (this=0x7fffffffdea0, receiver=receiver at entry=0x8fa300,
>> event=event at entry=0x7fffffffd720)
>>     at kernel/qcoreapplication.cpp:953
>> #17 0x00007ffff5d33d93 in sendEvent (event=<optimized out>,
>> receiver=<optimized out>) at
>> ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
>> #18 QApplicationPrivate::sendMouseEvent
>> (receiver=receiver at entry=0x8fa300, event=event at entry=0x7fffffffd720,
>> alienWidget=alienWidget at entry=0x0,
>>     nativeWidget=nativeWidget at entry=0x8fa300,
>> buttonDown=buttonDown at entry=0x7ffff6813318 <qt_button_down>,
>> lastMouseReceiver=..., spontaneous=spontaneous at entry=true)
>>     at kernel/qapplication.cpp:3178
>> #19 0x00007ffff5da8d1c in QETWidget::translateMouseEvent
>> (this=this at entry=0x8fa300, event=event at entry=0x7fffffffda70) at
>> kernel/qapplication_x11.cpp:4568
>> #20 0x00007ffff5da8289 in QApplication::x11ProcessEvent
>> (this=0x7fffffffdea0, event=event at entry=0x7fffffffda70) at
>> kernel/qapplication_x11.cpp:3627
>> #21 0x00007ffff5dcfb32 in x11EventSourceDispatch (s=0x7014c0,
>> callback=0x0, user_data=0x0) at
>> kernel/qguieventdispatcher_glib.cpp:146
>> #22 0x00007fffebe71e04 in g_main_context_dispatch () from
>> /lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #23 0x00007fffebe72048 in ?? () from
>> /lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #24 0x00007fffebe720ec in g_main_context_iteration () from
>> /lib/x86_64-linux-gnu/libglib-2.0.so.0
>> #25 0x00007ffff58297a1 in QEventDispatcherGlib::processEvents
>> (this=0x716010, flags=...) at kernel/qeventdispatcher_glib.cpp:434
>> #26 0x00007ffff5dcfbe6 in QGuiEventDispatcherGlib::processEvents
>> (this=<optimized out>, flags=...) at
>> kernel/qguieventdispatcher_glib.cpp:204
>> #27 0x00007ffff57fb0af in QEventLoop::processEvents
>> (this=this at entry=0x7fffffffde40, flags=...) at
>> kernel/qeventloop.cpp:149
>> #28 0x00007ffff57fb3a5 in QEventLoop::exec
>> (this=this at entry=0x7fffffffde40, flags=...) at
>> kernel/qeventloop.cpp:204
>> #29 0x00007ffff5800b79 in QCoreApplication::exec () at
>> kernel/qcoreapplication.cpp:1225
>> #30 0x00000000004094e6 in main (argc=1, argv=0x7fffffffdfd8) at
>>
>>
>> /home/houssen/Programs/ParaView/ParaView-v4.3.1-source/BUILD/Applications/ParaView/paraview_main.cxx:115
>>
>>
>> Le 2015-08-06 23:12, Sebastien Jourdain a écrit :
>>
>>> Something else must be wrong. No matter what you should be able to get
>>> the ProxyManager.
>>>
>>> What does the debugger tell you about the cause of the crash?
>>>
>>> Seb
>>>
>>> On Thu, Aug 6, 2015 at 3:08 PM, houssen <houssen at ipgp.fr [11]> wrote:
>>>
>>> Unfortunately, the code crashes when I call
>>>> vtkSMProxyManager::GetProxyManager ().
>>>> Is there another way ?
>>>>
>>>> Franck
>>>>
>>>> Le 2015-08-06 16:32, Sebastien Jourdain a écrit :
>>>>
>>>> Try that:
>>>>>
>>>>> vtkSMProxyManager::GetProxyManager()->GetActiveSession()
>>>>>
>>>>> On Thu, Aug 6, 2015 at 2:50 AM, houssen <houssen at ipgp.fr [5]
>>>>> [5]> wrote:
>>>>>
>>>>> Hello,
>>>>>>
>>>>>> In ParaView, from an exporter plugin, how can I get the active
>>>>>> session ? (= session associated to the plugin in order later
>>>>>> on to
>>>>>> scan over vtkSMProxy)
>>>>>>
>>>>>> Following some code samples found in
>>>>>> /ParaViewCore/ClientServerCore/Rendering, I tried to do :
>>>>>> vtkProcessModule * pProcMgr =
>>>>>> vtkProcessModule::GetProcessModule
>>>>>> ();
>>>>>> vtkSMSession * pSession = ( pProcMgr ) ?
>>>>>> vtkSMSession::SafeDownCast ( pProcMgr -> GetActiveSession () )
>>>>>> :
>>>>>> NULL;
>>>>>> I get pProcMgr != NULL but pSession = NULL
>>>>>>
>>>>>> Franck
>>>>>>
>>>>>> PS : I run Ubuntu-14.04 and use ParaView-4.3.1 (built from
>>>>>> source).
>>>>>>
>>>>>> _______________________________________________
>>>>>> Powered by www.kitware.com [1] [1]
>>>>>>
>>>>>> Visit other Kitware open-source projects at
>>>>>> http://www.kitware.com/opensource/opensource.html [2] [2]
>>>>>>
>>>>>> Search the list archives at:
>>>>>> http://markmail.org/search/?q=Paraview-developers [3] [3]
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://public.kitware.com/mailman/listinfo/paraview-developers
>>>>>> [4] [4]
>>>>>>
>>>>>
>>>>> Links:
>>>>> ------
>>>>> [1] http://www.kitware.com [6]
>>>>> [2] http://www.kitware.com/opensource/opensource.html [7]
>>>>> [3] http://markmail.org/search/?q=Paraview-developers [8]
>>>>> [4]
>>>>> http://public.kitware.com/mailman/listinfo/paraview-developers
>>>>>
>>>> [9]
>>>>
>>>>> [5] mailto:houssen at ipgp.fr [10]
>>>>>
>>>>
>>>
>>>
>>> Links:
>>> ------
>>> [1] http://www.kitware.com
>>> [2] http://www.kitware.com/opensource/opensource.html
>>> [3] http://markmail.org/search/?q=Paraview-developers
>>> [4] http://public.kitware.com/mailman/listinfo/paraview-developers
>>> [5] mailto:houssen at ipgp.fr
>>> [6] http://www.kitware.com
>>> [7] http://www.kitware.com/opensource/opensource.html
>>> [8] http://markmail.org/search/?q=Paraview-developers
>>> [9] http://public.kitware.com/mailman/listinfo/paraview-developers
>>> [10] mailto:houssen at ipgp.fr
>>> [11] mailto:houssen at ipgp.fr
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20150806/97898660/attachment-0001.html>


More information about the Paraview-developers mailing list