Stack Overflow??? bei OnCancel dialog?



  • Hier absturz:

    void CDlgProcess::OnCancel(){
    
    	m_bAbort = true;
    	OnCancel();
    }
    

    Dialog Klasse:

    #pragma once
    
    // CDlgProcess-Dialogfeld
    
    class CDlgProcess : public CDialog{
    	DECLARE_DYNAMIC(CDlgProcess)
    
    	BOOL m_bAbort;			//Abbruch
    
    public:
    	CDlgProcess(CWnd* pParent = NULL);   // Standardkonstruktor
    	virtual ~CDlgProcess();
    
    	//Abbruch Bedingung (Messageloop)
    	BOOL Abort();
    
    // Dialogfelddaten
    	enum { IDD = IDD_PROCESS };
    
    protected:
    	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV-Unterstützung
    
    	DECLARE_MESSAGE_MAP()
    public:
    	afx_msg void OnCancel();
    	//afx_msg void OnBnClickedCancel();
    };
    

    P.S.: ich rufe diese Dialog von einem anderen dialog auf (wenn das ein unterscheid macht) bisher hab ich immer nur dilaog vom hauptfenster aus
    geöffnet!!

    CDlgProcess dlg(this);
    	dlg.DoModal();
    

    jemand ne idEE??



  • was steht in der CDlgProcess::OnInitDialog bzw. unter

    //Abbruch Bedingung (Messageloop)
    BOOL Abort();



  • habe keine (noch keine OnInitDlg) ...

    die Abrot funk sieht so aus:

    //////////////////////////////////////////////////////////////////
    // Abort: Abbruch funktion Abbruchbedingung
    //////////////////////////////////////////////////////////////////
    BOOL CDlgProcess::Abort() {
    
    	MSG msg;
        while (::PeekMessage(&msg, NULL, 
            NULL, NULL, PM_NOREMOVE)) {
            AfxGetThread()->PumpMessage();
        }
        return m_bAbort;
    }
    


  • mach mal

    CDialog::OnCancel();
    

    So Rekursion ohne Abbruchbedingung führt nunmal meist zu nem Stackoverflow 🤡



  • ok sauber... thx;)))


Anmelden zum Antworten