Fixed docview crash bug when On... functions return FALSE.

Fixed valgen.cpp to cope with strings in wxChoice/wxComboBox.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7639 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-06-24 08:05:21 +00:00
parent 1ac341e016
commit 7aed63fdb7
11 changed files with 727 additions and 668 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -11,6 +11,9 @@ perfect because in this particular case it would be much better to just
\helpref{Wait()}{wxthreadwait} for the worker thread, but if there are several \helpref{Wait()}{wxthreadwait} for the worker thread, but if there are several
worker threads it already makes much more sense). worker threads it already makes much more sense).
Once the thread(s) are signaled, the condition then resets to the not
signaled state, ready to fire again.
\wxheading{Derived from} \wxheading{Derived from}
None. None.
@@ -51,18 +54,16 @@ Signals the object.
\membersection{wxCondition::Wait}\label{wxconditionwait} \membersection{wxCondition::Wait}\label{wxconditionwait}
\func{void}{Wait}{\param{wxMutex\&}{ mutex}} \func{void}{Wait}{\void}
Waits indefinitely. Waits indefinitely.
\func{bool}{Wait}{\param{wxMutex\&}{ mutex}, \param{unsigned long}{ sec}, \param{unsigned long}{ nsec}} \func{bool}{Wait}{\param{unsigned long}{ sec}, \param{unsigned long}{ nsec}}
Waits until a signal is raised or the timeout has elapsed. Waits until a signal is raised or the timeout has elapsed.
\wxheading{Parameters} \wxheading{Parameters}
\docparam{mutex}{wxMutex object.}
\docparam{sec}{Timeout in seconds} \docparam{sec}{Timeout in seconds}
\docparam{nsec}{Timeout nanoseconds component (added to {\it sec}).} \docparam{nsec}{Timeout nanoseconds component (added to {\it sec}).}

View File

@@ -57,9 +57,9 @@ MyApp::MyApp(void)
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
{ {
//// Find out if we're: //// Find out if we're:
//// SDI : multiple windows and documents but not MDI //// multiple window: multiple windows, each view in a separate frame
//// MDI : multiple windows and documents with containing frame - MSW only) //// single window: one view (within the main frame) and one document at a time, as in Windows Write.
/// single window : (one document at a time, only one frame, as in Windows Write) //// In single window mode, we only allow one document type
if (argc > 1) if (argc > 1)
{ {
if (wxStrcmp(argv[1], _T("-single")) == 0) if (wxStrcmp(argv[1], _T("-single")) == 0)

View File

@@ -172,6 +172,8 @@ bool wxDocument::OnCloseDocument()
// deleted. // deleted.
bool wxDocument::DeleteAllViews() bool wxDocument::DeleteAllViews()
{ {
wxDocManager* manager = GetDocumentManager();
wxNode *node = m_documentViews.First(); wxNode *node = m_documentViews.First();
while (node) while (node)
{ {
@@ -184,6 +186,11 @@ bool wxDocument::DeleteAllViews()
delete view; // Deletes node implicitly delete view; // Deletes node implicitly
node = next; node = next;
} }
// If we haven't yet deleted the document (for example
// if there were no views) then delete it.
if (manager->GetDocuments().Member(this))
delete this;
return TRUE; return TRUE;
} }
@@ -655,7 +662,8 @@ wxDocument *wxDocTemplate::CreateDocument(const wxString& path, long flags)
return doc; return doc;
else else
{ {
delete doc; if (GetDocumentManager()->GetDocuments().Member(doc))
doc->DeleteAllViews();
return (wxDocument *) NULL; return (wxDocument *) NULL;
} }
} }
@@ -1096,7 +1104,8 @@ wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags)
newDoc->SetDocumentTemplate(temp); newDoc->SetDocumentTemplate(temp);
if (!newDoc->OnOpenDocument(path2)) if (!newDoc->OnOpenDocument(path2))
{ {
delete newDoc; newDoc->DeleteAllViews();
// delete newDoc; // Implicitly deleted by DeleteAllViews
return (wxDocument *) NULL; return (wxDocument *) NULL;
} }
AddFileToHistory(path2); AddFileToHistory(path2);
@@ -1340,7 +1349,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
0, 0,
wxTheApp->GetTopWindow()); wxTheApp->GetTopWindow());
if (!pathTmp.IsEmpty()) if (!pathTmp.IsEmpty() && wxFileExists(pathTmp))
{ {
m_lastDirectory = wxPathOnly(pathTmp); m_lastDirectory = wxPathOnly(pathTmp);

View File

@@ -219,8 +219,33 @@ bool wxGenericValidator::TransferToWindow(void)
pControl->SetSelection(*m_pInt) ; pControl->SetSelection(*m_pInt) ;
return TRUE; return TRUE;
} }
else if (m_pString)
{
if (pControl->FindString(* m_pString) > -1)
{
pControl->SetStringSelection(* m_pString);
}
return TRUE;
}
} else } else
#endif #endif
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
{
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
if (m_pInt)
{
pControl->SetSelection(*m_pInt) ;
return TRUE;
}
else if (m_pString)
{
if (pControl->FindString(* m_pString) > -1)
{
pControl->SetStringSelection(* m_pString);
}
return TRUE;
}
} else
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
{ {
wxStaticText* pControl = (wxStaticText*) m_validatorWindow; wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
@@ -395,6 +420,11 @@ bool wxGenericValidator::TransferFromWindow(void)
*m_pString = pControl->GetValue() ; *m_pString = pControl->GetValue() ;
return TRUE; return TRUE;
} }
else if (m_pString)
{
*m_pString = pControl->GetStringSelection();
return TRUE;
}
} else } else
#endif #endif
#if wxUSE_CHOICE #if wxUSE_CHOICE
@@ -406,8 +436,27 @@ bool wxGenericValidator::TransferFromWindow(void)
*m_pInt = pControl->GetSelection() ; *m_pInt = pControl->GetSelection() ;
return TRUE; return TRUE;
} }
else if (m_pString)
{
*m_pString = pControl->GetStringSelection();
return TRUE;
}
} else } else
#endif #endif
if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
{
wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
if (m_pInt)
{
*m_pInt = pControl->GetSelection() ;
return TRUE;
}
else if (m_pString)
{
*m_pString = pControl->SetStringSelection(* m_pString);
return TRUE;
}
} else
if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) ) if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
{ {
wxStaticText* pControl = (wxStaticText*) m_validatorWindow; wxStaticText* pControl = (wxStaticText*) m_validatorWindow;