User forums > Nightly builds

The 12 January 2006 build is out.

<< < (3/4) > >>

Michael:

--- Quote from: Ceniza on January 13, 2006, 08:31:36 pm ---slaves developers

--- End quote ---

Ehm...slaves :D? I used the same methaphor with my old project supervisor :).

Michael

killerbot:

--- Quote from: artoj on January 13, 2006, 03:51:41 pm ---Thanks kkez and Michael. It seems I had already submitted the bug to SF.net :oops: but I now added the steps how to reproduce the bug better.


--- Quote from: kkez on January 13, 2006, 02:23:53 pm ---I may have found another bug:
1) Create a new file.
2) Modify it but don't save it.
3) Close this file. The confirm save dialog is shown two times.

--- End quote ---

I can confirm. You should create a new bug to SourceForge.net's Code::Blocks project page.

--- End quote ---

was the file part of a project ??
I just tried without projects , and for the new file, only 1 message box came up.

artoj:

--- Quote from: killerbot on January 13, 2006, 09:09:15 pm ---was the file part of a project ??
I just tried without projects , and for the new file, only 1 message box came up.

--- End quote ---

EDIT: You need to select No when the confirm dialog pops up first time.

So:

1) Create a new file.
2) Modify it but don't save it.
3) Close this file.
4) Select No.

The dialog is shown twice.

killerbot:
I have found the problem and have a solution.

When you call close by right clicking on the tab , you end up in this function :

--- Code: ---bool EditorManager::Close(EditorBase* editor,bool dontsave)
{
    SANITY_CHECK(false);
    if (editor)
{
int idx = FindPageFromEditor(editor);
if (idx != -1)
{
            if(!dontsave)
                if(!QueryClose(editor))
                    return false;
            wxString filename = editor->GetFilename();
//            LOGSTREAM << wxString::Format(_T("Close(): ed=%p, title=%s\n"), editor, editor ? editor->GetTitle().c_str() : _T(""));
            m_pNotebook->DeletePage(idx);
}
}
    m_pData->m_NeedsRefresh = true;
    return true;
}

--- End code ---

-> The QueryClose() call shows the message box. When the user clicks on no, the function returns true, so it ends up at m_pNoteBook->DeletePage(idx), and that one will call OnPageClosing

--- Code: ---void EditorManager::OnPageClosing(wxFlatNotebookEvent& event)
{
    EditorBase* eb = static_cast<EditorBase*>(m_pNotebook->GetPage(event.GetSelection()));
//    LOGSTREAM << wxString::Format(_T("OnPageClosing(): ed=%p, title=%s\n"), eb, eb ? eb->GetTitle().c_str() : _T(""));
    if (!QueryClose(eb))
        event.Veto();
    event.Skip(); // allow others to process it too
}

--- End code ---
Which calls .... QueryClose() --> so a second message box.

If you close with the x button, then you end up immediately in OnPageClosing -> 1 message box.

My suggestion is to remove the part :

            if(!dontsave)
                if(!QueryClose(editor))
                    return false;
            wxString filename = editor->GetFilename();
//            LOGSTREAM << wxString::Format(_T("Close(): ed=%p, title=%s\n"), editor, editor ? editor->GetTitle().c_str() : _T(""));

EditorManager::QueryClose returns false, only when the saving faild for some reason or the user pressed cancel, then EditorManager::Close will return after the QueryClose call and not call the notebook anymore, so no problem for this either, the one time change is in both cases best suited inthe notebook.

Another thing is then the QueryClose checks on ed->GetModified() and on a NO click it will do ed->SetModified(false); so that means in our secon call the GetModified should return false (and hence no message box), but it seems again this returns true.



But Yiannis could you take a look at it ? Maybe the functions is also called in other flows where it is still needed ???



[EDIT], the reason why the second modify again gets returned true is :
bool cbEditor::GetModified()
{
    return m_Modified || m_pControl->GetModify();
}

m_Modified was set to false, but it is the second part that make the whole evaluate to true.

mandrav:

--- Quote from: killerbot on January 13, 2006, 09:54:29 pm ---I have found the problem and have a solution.

--- End quote ---

Hehe, as always ;)
Fixed.
Thanks Lieven.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version