Commits

Daniel Rentz [dr]  committed 656e3ae

mib19: #163655# do not fire events when document is disposed

  • Participants
  • Parent commits b76dd88

Comments (0)

Files changed (1)

File sc/source/ui/docshell/docsh.cxx

                     xVbaEvents->processVbaEvent( WORKBOOK_AFTERSAVE, aArgs );
                 }
                 break;
+                case SFX_EVENT_CLOSEDOC:
+                {
+                    // #163655# prevent event processing after model is disposed
+                    aDocument.SetVbaEventProcessor( uno::Reference< script::vba::XVBAEventProcessor >() );
+                    uno::Reference< lang::XEventListener >( xVbaEvents, uno::UNO_QUERY_THROW )->disposing( lang::EventObject() );
+                }
+                break;
             }
         }
     }
                             SetReadOnlyUI( sal_True );
                         }
                     }
-
-                    // VBA specific initialization
-                    if( aDocument.IsInVBAMode() ) try
-                    {
-                        uno::Reference< frame::XModel > xModel( GetModel(), uno::UNO_SET_THROW );
-                        
-                        // create VBAGlobals object if not yet done (this also creates the "ThisExcelDoc" symbol and the event processor)
-                        uno::Reference< lang::XMultiServiceFactory > xFactory( xModel, uno::UNO_QUERY_THROW );
-                        xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
-                    }
-                    catch( uno::Exception& )
-                    {
-                    }
                 }
                 break;
             case SFX_EVENT_VIEWCREATED: