Handle exceptions in user drop targets code in wxMSW
All exceptions thrown by wxDropTarget::OnXXX() must be caught and handled in the same way as we already do it for the exceptions in the event handlers as we can't let the exceptions escape into system/kernel code: while it can work in some cases, it doesn't work in general, e.g. exceptions simply disappear when they happen in 32 bit programs under 64 bit Windows 7.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/msw/wrapwin.h"
|
||||
#include "wx/except.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
@@ -180,6 +181,8 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
|
||||
DWORD grfKeyState,
|
||||
POINTL pt,
|
||||
DWORD *pdwEffect)
|
||||
{
|
||||
wxTRY
|
||||
{
|
||||
wxLogTrace(wxTRACE_OleCalls, wxT("IDropTarget::DragEnter"));
|
||||
|
||||
@@ -244,6 +247,8 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
wxCATCH_ALL( wxEvtHandler::WXConsumeException(); return E_UNEXPECTED; )
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -259,6 +264,8 @@ STDMETHODIMP wxIDropTarget::DragEnter(IDataObject *pIDataSource,
|
||||
STDMETHODIMP wxIDropTarget::DragOver(DWORD grfKeyState,
|
||||
POINTL pt,
|
||||
LPDWORD pdwEffect)
|
||||
{
|
||||
wxTRY
|
||||
{
|
||||
// there are too many of them... wxLogDebug("IDropTarget::DragOver");
|
||||
|
||||
@@ -293,12 +300,16 @@ STDMETHODIMP wxIDropTarget::DragOver(DWORD grfKeyState,
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
wxCATCH_ALL( wxEvtHandler::WXConsumeException(); return E_UNEXPECTED; )
|
||||
}
|
||||
|
||||
// Name : wxIDropTarget::DragLeave
|
||||
// Purpose : Informs the drop target that the operation has left its window.
|
||||
// Returns : S_OK
|
||||
// Notes : good place to do any clean-up
|
||||
STDMETHODIMP wxIDropTarget::DragLeave()
|
||||
{
|
||||
wxTRY
|
||||
{
|
||||
wxLogTrace(wxTRACE_OleCalls, wxT("IDropTarget::DragLeave"));
|
||||
|
||||
@@ -313,6 +324,8 @@ STDMETHODIMP wxIDropTarget::DragLeave()
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
wxCATCH_ALL( wxEvtHandler::WXConsumeException(); return E_UNEXPECTED; )
|
||||
}
|
||||
|
||||
// Name : wxIDropTarget::Drop
|
||||
// Purpose : Instructs the drop target to paste data that was just now
|
||||
@@ -327,6 +340,8 @@ STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource,
|
||||
DWORD grfKeyState,
|
||||
POINTL pt,
|
||||
DWORD *pdwEffect)
|
||||
{
|
||||
wxTRY
|
||||
{
|
||||
wxLogTrace(wxTRACE_OleCalls, wxT("IDropTarget::Drop"));
|
||||
|
||||
@@ -371,6 +386,8 @@ STDMETHODIMP wxIDropTarget::Drop(IDataObject *pIDataSource,
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
wxCATCH_ALL( wxEvtHandler::WXConsumeException(); return E_UNEXPECTED; )
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// wxDropTarget implementation
|
||||
|
Reference in New Issue
Block a user