Re: CVS: commit msevior abiword-plugins/tools/abicollab/xp AbiCollab.cpp AbiCollab.h AbiCollab_Interface.cpp

From: Martin Sevior <msevior_at_physics.unimelb.edu.au>
Date: Wed Aug 30 2006 - 02:38:25 CEST

On Tue, 2006-08-29 at 13:53 +0000, cvs@abisource.com wrote:
> Update of /cvsroot/abiword-plugins/tools/abicollab/xp
> In directory abiword.snt.utwente.nl:/tmp/cvs-serv9991/xp
>
> Modified Files:
> AbiCollab.cpp AbiCollab.h AbiCollab_Interface.cpp
> Log Message:
>
> Lots of code to fix crashes on exit and closing the modeless dialog.
> Note the new method to unregister the plugins upon plugin deactivation. We need this to avoid crash on exists because the plugin mem chunk is made invalid on unload. This happens BEFORE the dialog is deleted from the app-wide dialog factory.
>

HI everyone,
            See the above commit notice. It's important to use the new
unregisterDialog method in XAP_DialogFactory.

XAP_DialogFactory::unregisterDialog(XAP_Dialog_Id id)

upon unloading your plugin. Otherwise you will cause a crash on exit
when the dialogFactory code attempts to delete a plugin in an invalid
mem region.

See this:

+bool AbiCollabFactoryContainer::unregisterDialogs(void)
+{
+ XAP_DialogFactory * pFactory = static_cast<XAP_DialogFactory
*>(XAP_App::getApp()->getDialogFactory());
+ pFactory->unregisterDialog(m_iDialogCollab_Id);
+ pFactory->unregisterDialog(m_iDialogCollabService_Id);
+ pFactory->unregisterDialog(m_iDialogCollabServiceDocs_Id);
 }
 
and this:

+ //
+ // Code to remove all the dialogs
+ //
+ s_CollabFactoryContainer.unregisterDialogs();
+
 }

cheers

Martin

>
> Index: AbiCollab.cpp
> ===================================================================
> RCS file: /cvsroot/abiword-plugins/tools/abicollab/xp/AbiCollab.cpp,v
> retrieving revision 1.72
> retrieving revision 1.73
> diff -u -d -r1.72 -r1.73
> --- AbiCollab.cpp 29 Aug 2006 04:07:21 -0000 1.72
> +++ AbiCollab.cpp 29 Aug 2006 13:53:35 -0000 1.73
> @@ -152,6 +152,15 @@
> m_iDialogCollab_Id = pFactory->registerDialog(ap_Collaboration_Constructor,XAP_DLGT_NON_PERSISTENT);
> m_iDialogCollabService_Id = pFactory->registerDialog(ap_CollaborationService_Constructor,XAP_DLGT_NON_PERSISTENT);
> m_iDialogCollabServiceDocs_Id = pFactory->registerDialog(ap_CollaborationService_Documents_Constructor,XAP_DLGT_MODELESS);
> + return true;
> +}
> +
> +bool AbiCollabFactoryContainer::unregisterDialogs(void)
> +{
> + XAP_DialogFactory * pFactory = static_cast<XAP_DialogFactory *>(XAP_App::getApp()->getDialogFactory());
> + pFactory->unregisterDialog(m_iDialogCollab_Id);
> + pFactory->unregisterDialog(m_iDialogCollabService_Id);
> + pFactory->unregisterDialog(m_iDialogCollabServiceDocs_Id);
> }
>
> bool AbiCollabFactoryContainer::extractParams(UT_UTF8String & sCommandLine,
>
> Index: AbiCollab.h
> ===================================================================
> RCS file: /cvsroot/abiword-plugins/tools/abicollab/xp/AbiCollab.h,v
> retrieving revision 1.34
> retrieving revision 1.35
> diff -u -d -r1.34 -r1.35
> --- AbiCollab.h 29 Aug 2006 04:07:21 -0000 1.34
> +++ AbiCollab.h 29 Aug 2006 13:53:35 -0000 1.35
> @@ -153,6 +153,7 @@
> void setServer(void) { m_bIsServer = true; }
> bool isServer(void) { return m_bIsServer; }
> bool registerDialogs(void);
> + bool unregisterDialogs(void);
> XAP_Dialog_Id getDialogCollabId(void)
> { return m_iDialogCollab_Id;}
> XAP_Dialog_Id getDialogCollabServiceId(void)
>
> Index: AbiCollab_Interface.cpp
> ===================================================================
> RCS file: /cvsroot/abiword-plugins/tools/abicollab/xp/AbiCollab_Interface.cpp,v
> retrieving revision 1.5
> retrieving revision 1.6
> diff -u -d -r1.5 -r1.6
> --- AbiCollab_Interface.cpp 29 Aug 2006 04:07:21 -0000 1.5
> +++ AbiCollab_Interface.cpp 29 Aug 2006 13:53:35 -0000 1.6
> @@ -136,7 +136,7 @@
> pCollab->getRemoteListener()->set(50);
> pCollab->getRemoteListener()->start();
> }
> -
> + pDialogFactory->releaseDialog(pDialog);
> return true;
> }
>
> @@ -435,4 +435,9 @@
> XAP_Frame* pFrame = pApp->getFrame(i);
> pFrame->rebuildMenus();
> }
> + //
> + // Code to remove all the dialogs
> + //
> + s_CollabFactoryContainer.unregisterDialogs();
> +
> }
>
> -----------------------------------------------
> To unsubscribe from this list, send a message to
> abisource-cvs-commit-request@abisource.com with the word
> unsubscribe in the message body.
Received on Wed Aug 30 02:41:45 2006

This archive was generated by hypermail 2.1.8 : Wed Aug 30 2006 - 02:41:46 CEST