#88347# Store components in vector to dispose them after Basic execution

This commit is contained in:
Andreas Bregas
2001-08-01 10:02:48 +00:00
parent b80751ba88
commit 98bcb99022
3 changed files with 38 additions and 6 deletions

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: eventatt.cxx,v $
*
* $Revision: 1.9 $
* $Revision: 1.10 $
*
* last change: $Author: thb $ $Date: 2001-06-20 07:43:30 $
* last change: $Author: ab $ $Date: 2001-08-01 11:00:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -576,6 +576,10 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
StarBASIC* pStartedBasic = pINST->GetBasic();
attachDialogEvents( pStartedBasic, xDlg );
// Add dialog to dispose vector
Reference< XComponent > xDlgComponent( xDlg, UNO_QUERY );
pINST->getComponentVector().push_back( xDlgComponent );
// Return dialog
Any aRetVal;
aRetVal <<= xDlg;

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: runtime.hxx,v $
*
* $Revision: 1.9 $
* $Revision: 1.10 $
*
* last change: $Author: ab $ $Date: 2001-06-15 13:10:59 $
* last change: $Author: ab $ $Date: 2001-08-01 10:59:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,8 +78,14 @@
#include <osl/file.hxx>
#endif
#include <vector>
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
using namespace rtl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
// Define activates old file implementation
@@ -171,6 +177,13 @@ public:
// laufende BASICs werden ueber verkettete Instanzen verwaltet. Hier liegen
// alle Daten, die nur leben, wenn BASIC auch lebt, wie z.B. das I/O-System.
typedef ::std::vector
<
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
>
ComponentVector_t;
class SbiInstance
{
friend class SbiRuntime;
@@ -189,6 +202,8 @@ class SbiInstance
USHORT nErl; // aktuelle Fehlerzeile
BOOL bReschedule; // Flag: TRUE = Reschedule in Hauptschleife
ComponentVector_t ComponentVector;
public:
SbiRuntime* pRun; // Call-Stack
SbiInstance* pNext; // Instanzen-Chain
@@ -214,6 +229,8 @@ public:
void EnableReschedule( BOOL bEnable ) { bReschedule = bEnable; }
BOOL IsReschedule( void ) { return bReschedule; }
ComponentVector_t& getComponentVector( void ) { return ComponentVector; }
SbMethod* GetCaller( USHORT );
SbModule* GetActiveModule();
SbxArray* GetLocals( SbMethod* );

View File

@@ -2,9 +2,9 @@
*
* $RCSfile: runtime.cxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: ab $ $Date: 2000-11-23 17:11:50 $
* last change: $Author: ab $ $Date: 2001-08-01 11:02:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -301,6 +301,17 @@ SbiInstance::~SbiInstance()
delete pDdeCtrl;
delete pDllMgr;
delete pNumberFormatter;
// Dispose components, especially dialogs created in CreateUnoDialog
ComponentVector_t::const_iterator iPos( ComponentVector.begin() );
while( iPos != ComponentVector.end() )
{
Reference< XComponent > xDlgComponent = *iPos ;
if( xDlgComponent.is() )
xDlgComponent->dispose();
++iPos;
}
ComponentVector.clear();
}
SbiDllMgr* SbiInstance::GetDllMgr()