Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » DropList cores on ClearList()
DropList cores on ClearList() [message #2779] Tue, 25 April 2006 10:51 Go to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

I was hoping I could get some debug insight into a problem I have currently.

We use a DropList, which we populate with about 10 or so items using the droplist.Add(int, String) syntax. I've added a menu option that will call

 droplist.ClearList();
 droplist.Clear();
 droplist.Add(5, "item 1");
 ... more Adds to re-populate list.



Initially, this works, ClearList()/Clear() appear ok on an empty Widget. But the second time it will core dump.

If I take out the ClearList() and Clear() calls, it works fine, except of course the DropList item now has duplicated (doubling each time I use the menu option).

I tried to reproduce this in Converter example, but I was unable to make it crash, so I assume it is something silly in my code.


The coredump traceback is rather deep, apologies:

#0  0x080fb7ed in Rect_<int>::operator==(Rect_<int> const&) const (
    this=0x6565724a, b=@0xbfbe4d40)
    at /home/lundman/upp/uppsrc/Core/Gtypes.h:513
513		return top == b.top && bottom == b.bottom && left == b.left && right == b.right;
(gdb) bt
#0  0x080fb7ed in Rect_<int>::operator==(Rect_<int> const&) const (
    this=0x6565724a, b=@0xbfbe4d40)
    at /home/lundman/upp/uppsrc/Core/Gtypes.h:513
#1  0x081625c3 in Ctrl::AddScroll(Rect_<int> const&, int, int) ()
#2  0x081629a8 in Ctrl::ScrollView(Rect_<int> const&, int, int) ()
#3  0x080a6e14 in Scroller::Scroll(Ctrl&, Rect_<int> const&, Point_<int>, Size_<int>) ()
#4  0x080b088e in ArrayCtrl::Scroll() ()
#5  0x08075f2c in CallbackMethodAction<ArrayCtrl, void (ArrayCtrl::*)()>::Execute() (this=0x87ad7b8) at /home/lundman/upp/uppsrc/Core/Cbgen.h:31
#6  0x082cba65 in Callback::Execute() const ()
#7  0x0807608b in Callback::operator()() const (this=0xbfbf6860)
    at /home/lundman/upp/uppsrc/Core/Cbgen.h:63
#8  0x080a3eb9 in ScrollBar::Set(int) ()
#9  0x080a485e in ScrollBar::Layout() ()
#10 0x08160dec in Ctrl::SyncLayout(bool) ()
#11 0x08160fa0 in Ctrl::UpdateRect() ()
#12 0x08160ec3 in Ctrl::SetPos0(Ctrl::LogPos, bool) ()
#13 0x0816104d in Ctrl::SetPos(Ctrl::LogPos, bool) ()
#14 0x08161162 in Ctrl::SetFramePos(Ctrl::LogPos) ()
#15 0x08161fff in Ctrl::SetFramePos(Ctrl::Logc, Ctrl::Logc) ()
#16 0x08161370 in Ctrl::SetFrameRect(int, int, int, int) ()
#17 0x08158bcc in LayoutFrameRight(Rect_<int>&, Ctrl*, int) ()
---Type <return> to continue, or q <return> to quit---
#18 0x080a4930 in ScrollBar::FrameLayout(Rect_<int>&) ()
#19 0x08160c57 in Ctrl::SyncLayout(bool) ()
#20 0x08091e33 in Ctrl::RefreshLayout() ()
#21 0x0809193f in Ctrl::RefreshParentLayout() ()
#22 0x0815a450 in Ctrl::Show(bool) ()
#23 0x080a3f55 in ScrollBar::Set(int, int, int) ()
#24 0x080a4027 in ScrollBar::SetTotal(int) ()
#25 0x080af339 in ArrayCtrl::SetSb() ()
#26 0x080b71ce in ArrayCtrl::Clear() ()
#27 0x080c28d0 in DropList::ClearList() ()
#28 0x08065b9f in UFxp::do_SiteWipe() (this=0xbfbe5c40)
    at /home/lundman/upp/MyApps/UFxp/main.cpp:43
#29 0x08060bd1 in Trans::do_SITELIST() (this=0xbfbe60d4)
    at /home/lundman/upp/MyApps/UFxp/Trans.cpp:663
#30 0x08060c15 in Trans::do_SITELISTx() (this=0xbfbe60d4)
    at /home/lundman/upp/MyApps/UFxp/Trans.cpp:671
#31 0x08075ed6 in CallbackMethodAction<Trans, void (Trans::*)()>::Execute() (
    this=0x87c2188) at /home/lundman/upp/uppsrc/Core/Cbgen.h:31
#32 0x082cba65 in Callback::Execute() const ()
#33 0x0807608b in Callback::operator()() const (this=0x87c5f54)
    at /home/lundman/upp/uppsrc/Core/Cbgen.h:63
#34 0x082cbee7 in CallbackForkAction::Execute() ()
#35 0x082cba65 in Callback::Execute() const ()
---Type <return> to continue, or q <return> to quit---
#36 0x0807608b in Callback::operator()() const (this=0x87c3684)
    at /home/lundman/upp/uppsrc/Core/Cbgen.h:63
#37 0x080d1594 in MenuItem::LeftUp(Point_<int>, unsigned) ()
#38 0x08165f7c in Ctrl::MouseEvent(int, Point_<int>, int, unsigned) ()
#39 0x08165cdb in Ctrl::MouseEventH(int, Point_<int>, int, unsigned) ()
#40 0x081667d1 in Ctrl::MEvent0(int, Point_<int>, int) ()
#41 0x081674d8 in Ctrl::DispatchMouseEvent(int, Point_<int>, int) ()
#42 0x081674a0 in Ctrl::DispatchMouseEvent(int, Point_<int>, int) ()
#43 0x081674a0 in Ctrl::DispatchMouseEvent(int, Point_<int>, int) ()
#44 0x081671c8 in Ctrl::DispatchMouse(int, Point_<int>, int) ()
#45 0x08175da5 in Ctrl::EventProc(Ctrl::XWindow&, _XEvent*) ()
#46 0x0817109e in Ctrl::ProcessEvent(_XEvent*) ()
#47 0x0817167b in Ctrl::EventLoop(Ctrl*) ()
#48 0x0816e3f9 in TopWindow::Run(bool) ()
#49 0x080712a9 in GuiMainFn_() ()
    at /home/lundman/upp/MyApps/UFxp/main.cpp:1089
#50 0x08071204 in main (argc=1, argv=0xbfbfea18, envptr=0xbfbfea20)
    at /home/lundman/upp/MyApps/UFxp/main.cpp:1083
#51 0x08048166 in ___start ()




Re: DropList cores on ClearList() [message #2782 is a reply to message #2779] Tue, 25 April 2006 10:58 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
From the stacktrace it looks like some very specific case.

Would you mind posting the whole package here?

Mirek
Re: DropList cores on ClearList() [message #2784 is a reply to message #2782] Tue, 25 April 2006 11:37 Go to previous messageGo to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

The project has become somewhat large now, but its all in CVS if you really are keen.

I can add more curiosities.

When the Droplist is loaded, I set it to the value it was selected as last time (saved on disk) using plain "=" overloaded.

If I do not touch the Droplist, it works. Including refreshing multiple times.

If I open the droplist, and select something, including the item already selected, then refreshing will core as shown.

But no amount of trying to Focus on something else will stop it from crashing once I have picked something.

Re: DropList cores on ClearList() [message #2785 is a reply to message #2784] Tue, 25 April 2006 11:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
lundman wrote on Tue, 25 April 2006 05:37


The project has become somewhat large now, but its all in CVS if you really are keen.

I can add more curiosities.

When the Droplist is loaded, I set it to the value it was selected as last time (saved on disk) using plain "=" overloaded.

If I do not touch the Droplist, it works. Including refreshing multiple times.

If I open the droplist, and select something, including the item already selected, then refreshing will core as shown.

But no amount of trying to Focus on something else will stop it from crashing once I have picked something.





Actually, are not you doing those ClearList and Clear from inside of DropList WhenAction?

Mirek
Re: DropList cores on ClearList() [message #2786 is a reply to message #2785] Tue, 25 April 2006 12:48 Go to previous messageGo to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

Nope, nothing so unusual.. No .When* used at all.

grep sitelist will show only calls to:

ClearList
Clear
Add
GetCount
GetValue
GetKey


Re: DropList cores on ClearList() [message #2787 is a reply to message #2786] Tue, 25 April 2006 13:41 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, this is not enough info to get it resolved....

Would it at least be possible to post UFxp and Trans classes related files (.h + .cpp)?

Just zip them and post here...

Mirek
Re: DropList cores on ClearList() [message #2793 is a reply to message #2787] Tue, 25 April 2006 15:12 Go to previous messageGo to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

cvs -d ":pserver:anoncvs@lundman.net:/home/cvsroot" login
"anoncvs"

cvs -d ":pserver:anoncvs@lundman.net:/home/cvsroot" co UFxp



However, debugging by commenting crap out, I have tracked it down.

If in my reply to SITELIST, I simply Droplist.Add() it works, ie, commenting out my dreadful attempt to sort the Droplist.

If I put this code in, it will die:
    if (data.Has("END")) {
        // Sort list, then populate gui                                         
        // Create a map between names and siteid                                
        VectorMap <String,int> namelist;
        Dict *tmp;

        for (int i=0; i < sitelist.GetCount(); i++) {
            tmp = &sitelist[i];
            namelist.Add(tmp->Get("NAME"), atoi(tmp->Get("SITEID")));
        }

        // Sort said map based on name                                          
        Vector<int> o = GetSortOrder(namelist.GetKeys());

        // Look up name/id based on sorted order. This could use "namelist" ins\
tead                                                                            
        // of sitelist though.                                                  
        for(int i = 0; i < o.GetCount(); i++)
            gui->do_SiteAdd(atoi(sitelist[o[i]].Get("SITEID")), sitelist[o[i]].\
Get("NAME"));

        // Tell GUI the end is reached.                                         
        gui->do_SiteAdd(-1, "");
        return;
    }



Most likely because the Strings given are on the local stack.

Re: DropList cores on ClearList() [message #2805 is a reply to message #2793] Tue, 25 April 2006 22:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Accidentally, I think I have found it - when fixing completely unrelated stuff. At least the stack backtrace looks almost the same.

To fix it, add

top = NULL

at the end of WndDestroy functions (around line 382 of CtrlCore/X11Wnd.cpp) (before ending brace).

(Fix will be in the next release too).

Mirek
Re: DropList cores on ClearList() [message #2811 is a reply to message #2805] Wed, 26 April 2006 02:15 Go to previous message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

That works beautifully. Thanks.
Previous Topic: ColumnList question (move and delete item)
Next Topic: Strange behaviour of my modal dialog
Goto Forum:
  


Current Time: Sat May 04 00:37:30 CEST 2024

Total time taken to generate the page: 0.04059 seconds