Opened 11 years ago

Closed 10 years ago

#11656 closed defect (fixed)

Assert in notebook sample when changing book control type

Reported by: triton Owned by:
Priority: low Milestone:
Component: samples Version: stable-latest
Keywords: notebook sample Cc:
Blocked By: Blocking:
Patch: yes

Description

Open the Notebook sample and try to switch to Toolbook and it crashes.

I'm using Windows 7 and wxWidgets 2.9. I'll try later with 2.9.1 once I compile it.

Attachments (1)

assert.png download (59.6 KB) - added by triton 11 years ago.
Stacktrace of assert

Download all attachments as: .zip

Change History (11)

comment:1 Changed 11 years ago by vadz

  • Status changed from new to infoneeded_new

Works for me with current svn, if it still fails for you please provide a backtrace, thanks!

comment:2 Changed 11 years ago by catalin

Same as #11492 ?

comment:3 Changed 11 years ago by triton

  • Status changed from infoneeded_new to new

I can confirm this is working on. But I managed to get an assert somehow just by playing with the demo.

http://i48.tinypic.com/15zm4g8.png

comment:4 Changed 11 years ago by vadz

  • Component changed from wxMSW to samples
  • Keywords toolbook crash removed
  • Milestone 2.9.1 deleted
  • Priority changed from normal to low
  • Summary changed from Notebook sample crashes when Toolbook is selected to Assert in notebook sample when changing book control type

Would you have any hints about how can this be reproduced?

For future reference (in case the URL above goes away), the assert is in MyFrame::RecreateBook().

Changed 11 years ago by triton

Stacktrace of assert

comment:5 Changed 11 years ago by triton

  • Resolution set to fixed
  • Status changed from new to closed

I added the screenshot as an attachment for later reference.

I'll try to re-create the assert, but I don't know if I'll be able to... I should have saved the operations log in the sample. :)

comment:6 Changed 11 years ago by triton

  • Resolution fixed deleted
  • Status changed from closed to reopened

Damn sorry, this set to 'closed' automatically, wtf... Re-opened.

comment:7 Changed 10 years ago by wojdyr

  • Status changed from reopened to confirmed

it's probably the case when wxToolbook is created with unchecked Show Images.

../src/generic/toolbkg.cpp(300): assert "GetImageList() != __null" failed in InsertPage()

comment:8 Changed 10 years ago by vadz

  • Version changed from 2.9.0 to 2.9-svn

Indeed, thanks Marcin. Looking at the code, wxToolbook simply doesn't support not showing the images so I think the sample should be fixed to avoid using it in this case. In principle it could be possible to have a toolbar without images but I am not sure if it's really useful in practice.

comment:9 Changed 10 years ago by wojdyr

  • Patch set

i agree,
here is a small change that prevents assertion:

--- notebook.cpp        (revision 67192)
+++ notebook.cpp        (working copy)
@@ -552,6 +552,11 @@
     {
         m_bookCtrl->SetImageList(m_imageList);
     }
+    else if ( m_type == Type_Toolbook )
+    {
+        wxLogMessage(wxT("wxToolbook does not work without images!"));
+        m_bookCtrl->SetImageList(m_imageList);
+    }
 
     if ( oldBook )
     {

comment:10 Changed 10 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [67201]) Always use icons with wxToolbook in the notebook sample.

wxToolbook asserts and doesn't work if it has no images so always use them
with it in the sample to avoid it.

Closes #11656.

Note: See TracTickets for help on using tickets.