Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert in call to wxDataViewListCtrl::EditItem in a second wxDataViewListCtrl #17946

Closed
wxtrac opened this issue Sep 11, 2017 · 11 comments
Closed

Comments

@wxtrac
Copy link
Collaborator

wxtrac commented Sep 11, 2017

Issue migrated from trac ticket # 17946

component: wxGTK | priority: normal | resolution: fixed

2017-09-11 22:37:41: josuegomes created the issue


I'm getting the following assert when wxDataViewListCtrl::EditItem is called a second time.

../../src/wxwidgets/src/gtk/dataview.cpp(221): assert "gtk_tree_selection_get_select_function(m_selection) == func" failed in CheckCurrentSelectionFunc(): selection function has changed unexpectedly, review this code!

To reproduce: choose Menu, Show Dialog. In the dialog choose Add and then Close.
Again choose Menu, Show Dialog and in the dialog choose Add.

Ubuntu 17.04 x64, tested with master, WX_3_0_BRANCH and WX_3_0_3_BRANCH
Configured with --enable-debug --enable-unicode --disable-universal
Default config is gtk2-unicode-3.0

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 11, 2017

2017-09-11 22:37:57: josuegomes uploaded file wxbug.cpp (3.8 KiB)

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 11, 2017

2017-09-11 22:53:52: @oneeyeman1 commented


What's your exact GTK+ version?
After choosing "Add" what did you do? Or you immediately closed the dialog?

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 11, 2017

2017-09-11 23:19:43: josuegomes commented


What's your exact GTK+ version?

Hopefully this answers:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                         Version            Architecture Description
+++-============================-==================-============-============================================================
ii  libgtk-3-0:amd64             3.22.11-0ubuntu3   amd64        GTK+ graphical user interface library
ii  libgtk-3-common              3.22.11-0ubuntu3   all          common files for the GTK+ graphical user interface library
ii  libgtk2.0-0:amd64            2.24.31-1ubuntu1.1 amd64        GTK+ graphical user interface library
ii  libgtk2.0-bin                2.24.31-1ubuntu1.1 amd64        programs for the GTK+ graphical user interface library
ii  libgtk2.0-common             2.24.31-1ubuntu1.1 all          common files for the GTK+ graphical user interface library
ii  libgtk2.0-dev                2.24.31-1ubuntu1.1 amd64        development files for the GTK+ library

After choosing "Add" what did you do? Or you immediately closed the dialog?

Did nothing, just clicked Add (a new row is added) and then clicked Close.
Entering data in the new row makes no difference.

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 12, 2017

2017-09-12 15:40:37: josuegomes commented


Another test: I changed from modal to non-modal:

void MainFrame::ShowDialog(wxCommandEvent& WXUNUSED(event))
{
	MyDialog *dialog = new MyDialog(this);
	dialog->Show();
}

And tested like this: open two dialogs, clicked Add in the first dialog, when clicking Add in the second dialog then the assert shows.

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 12, 2017

2017-09-12 17:09:13: josuegomes changed title from Assert in a second call to wxDataViewListCtrl::EditItem to Assert in call to wxDataViewListCtrl::EditItem in a second wxDataViewListCtrl

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 12, 2017

2017-09-12 17:12:32: josuegomes commented


After further testing I found that assert occurs in a call to EditItem in a second wxDataViewListCtrl.

I'll provide a patch to the minimal sample (master) to ease the testing.

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 12, 2017

2017-09-12 18:20:32: josuegomes uploaded file 17946-minimal.patch (4.0 KiB)

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 12, 2017

2017-09-12 18:22:17: josuegomes commented


I have attached a patch for the minimal sample (at master).

To reproduce: apply patch, build, run, choose Help, About and again Help, About, in the first dialog click Add, in the second dialog click Add.

Below the stacktrace

ASSERT INFO:
../../src/wxwidgets-master/src/gtk/dataview.cpp(173): assert "gtk_tree_selection_get_select_function(m_selection) == func" failed in CheckCurrentSelectionFunc(): selection function has changed unexpectedly, review this code!

BACKTRACE:
[1] wxDataViewCtrl::EditItem(wxDataViewItem const&, wxDataViewColumn const*)
[2] wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const
[3] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[4] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[5] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[6] wxEvtHandler::TryHereOnly(wxEvent&)
[7] wxEvtHandler::ProcessEventLocally(wxEvent&)
[8] wxEvtHandler::ProcessEvent(wxEvent&)
[9] wxWindowBase::TryAfter(wxEvent&)
[10] wxEvtHandler::ProcessEvent(wxEvent&)
[11] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[12] wxWindowBase::HandleWindowEvent(wxEvent&) const
[13] g_closure_invoke
[14] g_signal_emit_valist
[15] g_signal_emit
[16] g_closure_invoke
[17] g_signal_emit_valist
[18] g_signal_emit
[19] g_closure_invoke
[20] g_signal_emit_valist
[21] g_signal_emit
[22] gtk_propagate_event
[23] gtk_main_do_event
[24] g_main_context_dispatch
[25] g_main_loop_run
[26] gtk_main
[27] wxGUIEventLoop::DoRun()
[28] wxEventLoopBase::Run()
[29] wxAppConsoleBase::MainLoop()
[30] wxAppConsoleBase::OnRun()
[31] wxAppBase::OnRun()
[32] wxEntry(int&, wchar_t**)
[33] wxEntry(int&, char**)
[34] __libc_start_main

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 13, 2017

2017-09-13 17:10:14: @vadz changed status from new to accepted

2017-09-13 17:10:14: @vadz commented

I can see it, thanks for the SSCCE.

@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 13, 2017

2017-09-13 17:34:30: @vadz changed status from accepted to closed

2017-09-13 17:34:30: @vadz set resolution to fixed

2017-09-13 17:34:30: @vadz commented

In 81d9952:
Really fix spurious asserts in wxGTK wxDataViewCtrl::EditItem()

This replaces the changes of 24c0401
which, for some reason, used a global variable for storing whether the
selection function had been already set or not, when this clearly is a
per-control (or per-selection, but this seems one and the same) bit of
information.

Replace global ms_firstTime with a wxDataViewCtrlInternal field to avoid
asserts as soon as EditItem() is called on more than one wxDataViewCtrl.

Closes #17946.

@wxtrac wxtrac closed this as completed Sep 13, 2017
@wxtrac
Copy link
Collaborator Author

wxtrac commented Sep 13, 2017

2017-09-13 17:36:09: @vadz commented


In 28aee1b:
Really fix spurious asserts in wxGTK wxDataViewCtrl::EditItem()

This replaces the changes of 24c0401
which, for some reason, used a global variable for storing whether the
selection function had been already set or not, when this clearly is a
per-control (or per-selection, but this seems one and the same) bit of
information.

Replace global ms_firstTime with a wxDataViewCtrlInternal field to avoid
asserts as soon as EditItem() is called on more than one wxDataViewCtrl.

See #17946.

(cherry picked from commit 81d9952)

margro pushed a commit to margro/wxWidgets that referenced this issue Mar 19, 2022
This replaces the changes of 24c0401
which, for some reason, used a global variable for storing whether the
selection function had been already set or not, when this clearly is a
per-control (or per-selection, but this seems one and the same) bit of
information.

Replace global ms_firstTime with a wxDataViewCtrlInternal field to avoid
asserts as soon as EditItem() is called on more than one wxDataViewCtrl.

See wxWidgets#17946.

(cherry picked from commit 81d9952)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant