replaced global semaphore in gtk_notebook_page_change_callback() with a per-object one

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-11-04 19:06:04 +00:00
parent 93f4047227
commit fa1837fe14
4 changed files with 18 additions and 12 deletions

View File

@@ -122,12 +122,15 @@ public:
// selection internally instead of querying the notebook for it // selection internally instead of querying the notebook for it
int m_selection; int m_selection;
// flag set to TRUE while we're inside "switch_page" callback
bool m_inSwitchPage;
protected: protected:
// remove one page from the notebook but do not destroy it // remove one page from the notebook but do not destroy it
virtual wxNotebookPage *DoRemovePage(int nPage); virtual wxNotebookPage *DoRemovePage(int nPage);
private: private:
// the padding set by SetPadding()
int m_padding; int m_padding;
DECLARE_DYNAMIC_CLASS(wxNotebook) DECLARE_DYNAMIC_CLASS(wxNotebook)

View File

@@ -122,12 +122,15 @@ public:
// selection internally instead of querying the notebook for it // selection internally instead of querying the notebook for it
int m_selection; int m_selection;
// flag set to TRUE while we're inside "switch_page" callback
bool m_inSwitchPage;
protected: protected:
// remove one page from the notebook but do not destroy it // remove one page from the notebook but do not destroy it
virtual wxNotebookPage *DoRemovePage(int nPage); virtual wxNotebookPage *DoRemovePage(int nPage);
private: private:
// the padding set by SetPadding()
int m_padding; int m_padding;
DECLARE_DYNAMIC_CLASS(wxNotebook) DECLARE_DYNAMIC_CLASS(wxNotebook)

View File

@@ -86,14 +86,12 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
gint page, gint page,
wxNotebook *notebook ) wxNotebook *notebook )
{ {
static bool s_inPageChange = FALSE;
// are you trying to call SetSelection() from a notebook event handler? // are you trying to call SetSelection() from a notebook event handler?
// you shouldn't! // you shouldn't!
wxCHECK_RET( !s_inPageChange, wxCHECK_RET( !notebook->m_inSwitchPage,
_T("gtk_notebook_page_change_callback reentered") ); _T("gtk_notebook_page_change_callback reentered") );
s_inPageChange = TRUE; notebook->m_inSwitchPage = TRUE;
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
@@ -123,7 +121,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
notebook->GetEventHandler()->ProcessEvent( eventChanged ); notebook->GetEventHandler()->ProcessEvent( eventChanged );
} }
s_inPageChange = FALSE; notebook->m_inSwitchPage = FALSE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -236,6 +234,8 @@ END_EVENT_TABLE()
void wxNotebook::Init() void wxNotebook::Init()
{ {
m_padding = 0; m_padding = 0;
m_inSwitchPage = FALSE;
m_imageList = (wxImageList *) NULL; m_imageList = (wxImageList *) NULL;
m_pagesData.DeleteContents( TRUE ); m_pagesData.DeleteContents( TRUE );
m_selection = -1; m_selection = -1;

View File

@@ -86,14 +86,12 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
gint page, gint page,
wxNotebook *notebook ) wxNotebook *notebook )
{ {
static bool s_inPageChange = FALSE;
// are you trying to call SetSelection() from a notebook event handler? // are you trying to call SetSelection() from a notebook event handler?
// you shouldn't! // you shouldn't!
wxCHECK_RET( !s_inPageChange, wxCHECK_RET( !notebook->m_inSwitchPage,
_T("gtk_notebook_page_change_callback reentered") ); _T("gtk_notebook_page_change_callback reentered") );
s_inPageChange = TRUE; notebook->m_inSwitchPage = TRUE;
if (g_isIdle) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
@@ -123,7 +121,7 @@ static void gtk_notebook_page_change_callback(GtkNotebook *WXUNUSED(widget),
notebook->GetEventHandler()->ProcessEvent( eventChanged ); notebook->GetEventHandler()->ProcessEvent( eventChanged );
} }
s_inPageChange = FALSE; notebook->m_inSwitchPage = FALSE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -236,6 +234,8 @@ END_EVENT_TABLE()
void wxNotebook::Init() void wxNotebook::Init()
{ {
m_padding = 0; m_padding = 0;
m_inSwitchPage = FALSE;
m_imageList = (wxImageList *) NULL; m_imageList = (wxImageList *) NULL;
m_pagesData.DeleteContents( TRUE ); m_pagesData.DeleteContents( TRUE );
m_selection = -1; m_selection = -1;