Skip to content

CFile: avoid 'Assert failure' if IsOpened() is false inside doSeek - #294

Merged
sc0w merged 3 commits into
amule-project:masterfrom
sc0w:PR_issue_29
Nov 22, 2021
Merged

CFile: avoid 'Assert failure' if IsOpened() is false inside doSeek#294
sc0w merged 3 commits into
amule-project:masterfrom
sc0w:PR_issue_29

Conversation

@sc0w

@sc0w sc0w commented Aug 31, 2021

Copy link
Copy Markdown
Member

Fixes #29

  • With first commit we see in the logs: ED2k Client: IO failure while reading requested file: SafeIO::IOFailure::SeekFailure: Seeking failed: Bad file descriptor instead the crash

  • With second commit we see in the logs: ED2k Client: IO failure while reading requested file: SafeIO::IOFailure::SeekFailure: Cannot seek on closed file. instead

@sc0w sc0w changed the title Cfile: avoid 'Assert failure' if IsOpened() is false inside doSeek CFile: avoid 'Assert failure' if IsOpened() is false inside doSeek Aug 31, 2021
@sc0w
sc0w merged commit 8fd8128 into amule-project:master Nov 22, 2021
@sc0w
sc0w deleted the PR_issue_29 branch November 22, 2021 07:41
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Jul 4, 2026
)

* fix(gui): scale main-toolbar icons on hi-DPI displays

The toolbar icons (Downloads, Shared Files, etc.) were stored in a
fixed 32x32 wxImageList and handed to wxToolBar as plain wxBitmaps.
Since the executable declares PerMonitorV2 DPI awareness (amule-project#780), those
bitmaps are drawn at 32 *physical* pixels, so on 4K / scaled displays
the icons render tiny and blurry while the rest of the UI scales.

Store each toolbar icon as a wxBitmapBundle instead (wx >= 3.2),
built from the original 32px art plus a wxIMAGE_QUALITY_HIGH 2x
upscale, converting the transparency mask to an alpha channel first
so the scaler doesn't smear the mask colour into the icon edges.
Drop the hard-coded SetToolBitmapSize(32,32) so the toolbar derives
the logical size from the bundles and scales it per monitor DPI.

SetMessagesTool gains a bounds guard because m_CurrentBlinkBitmap
starts as a stale sentinel (24) that the old wxImageList::GetBitmap
tolerated but vector indexing must not.

Co-Authored-By: Claude Fable 5 <[email protected]>

* refactor(gui): name toolbar icon indexes and drop dead code after review

Code-review follow-ups to the wxBitmapBundle toolbar change:

- Add ToolbarSkinEnum (mirroring ClientSkinEnum) so the m_tblist
  indexes duplicated across Apply_Toolbar_Skin, ShowConnectionState,
  OnGUITimer and the constructor are named instead of magic numbers
  whose meaning depends on the Add_Skin_Icon call order.
- Initialize m_CurrentBlinkBitmap to Toolbar_Messages instead of the
  stale sentinel 24 (a fossil amuleDlgImages() resource id, never a
  valid m_tblist index) and drop the SetMessagesTool bounds guard that
  existed only to defend against it; both callers assign a valid index
  right before calling, so behavior is identical.
- Remove the #ifdef __WXCOCOA__ branches in ShowConnectionState and
  SetMessagesTool: the old wxCocoa port was removed from wxWidgets
  before the 3.2 minimum this project requires (modern macOS defines
  __WXOSX_COCOA__), so those lines could never compile again.
- Use the two-bitmap wxBitmapBundle::FromBitmaps overload instead of
  building a wxVector by hand.

Co-Authored-By: Claude Fable 5 <[email protected]>

* style(gui): use emplace_back for the fallback toolbar bundle

Fixes the clang-tidy Tier-2 modernize-use-emplace warning on the
wxBitmapBundle fallback path in Add_Skin_Icon.

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Carlos Barrero <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
mrjimenez pushed a commit to mrjimenez/amule that referenced this pull request Jul 5, 2026
…ect#295)

The preferences dialog's page list (General, Connection, Directories,
etc.) fed 16x16 bitmaps into a fixed-size wxImageList, so on
DPI-aware builds the icons render at 16 physical pixels — tiny and
blurry on hi-DPI screens, same problem as the main toolbar (amule-project#294).

Hand the icons to the list control as wxBitmapBundles instead
(wxListCtrl::SetSmallImages, wx >= 3.2), each built from the 16px art
plus a wxIMAGE_QUALITY_HIGH 2x upscale with the mask converted to an
alpha channel first. The macOS-only right/bottom padding is applied
per resolution so the padded canvas keeps its proportions at 2x.

Co-authored-by: Carlos Barrero <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2.4.0 @ 0023527b - Assertion failed: ../../src/CFile.cpp:doSeek:370: Assertion 'Assert failure' failed. ((IsOpened()))

1 participant