Today, we bring you a new report on the Maui Project progress.

Are you a developer and want to start developing cross-platform and convergent apps, targeting, among other things, the upcoming Linux Mobile devices?, Then join us on Telegram: https://t.me/mauiproject.

We are present on Twitter and Mastodon:

On the 26th of September, we will be giving a talk at QtCon Brasil 2020, where we will share our experience in building a convergent environment; you can join us and ask us any questions:

QtCon Brasil 2020 – Convergence


KDE Review

For the next stable release, we have submitted MauiKit and Index to KDE Review. Projects move into KDE Review when they are ready to start making beta or stable releases. It allows for the KDE community to check over for minimum standards.

The next projects to be submitted are going to be VVave and Pix. We expect, as an outcome of the review, to improve on many aspects suggested by the reviewers.

The documentation of MauiKit controls is still an ongoing task.

MauiKit

This week’s updates bring polished and refined components, more cohesive styling, better touch, and mouse inputs support in different navigation patterns, and code refactoring and clean up for better maintainability and performance.

Some of the highlights are:

Controls

The MauiKit controls premise is to be convergent, meaning: to have a responsive layout under-constrained or wide spaces, adaptable, feature-rich, and react to touch or mouse-based inputs accordingly. With this in mind, we keep on improving the core controls we ship with MauiKit.

The SettingsDialog, SettingSection and SettingSectionTemplate

The SettingsDialog layout is now more uniform, and its SettingsSection now uses a background color to differentiate items and target the right one more promptly. The SettingTemplate, which is used to contain each different setting option in the section, now has a setting property that allows to quickly store persistent values in configuration file dependent on the app; you just need to set a key and group to the setting value to be stored, and when the value is changed just save it with setting.setValue(newValue)

Maui.SettingTemplate
{
  id: _autoScan

  label1.text: i18n("Auto Scan")
  label2.text: i18n("Scan all the music sources on startup to keep your collection updated.")

  setting.key: "ScanCollectionOnStartUp"
  setting.group: "Settings"
  setting.defaultValue: true

  Switch
  {
    checkable: true
    checked: _autoScan.setting.value() == "true"
    onToggled: _autoScan.setting.setValue(checked)
  }
}

 

Pix and Nota settings dialog

The SettingSection can also now be collapsed.

ItemDelegate and Templates

A widely used set of controls are the templates, which provide a feature-rich and responsive experience out of the box. Most of the MauiKit template controls have received nice papercut fixes, from the ListItemTemplate and GridItemtemplate to the ListBrowser and GridView.

The ItemDelegate now draws borders to better hint about its boundaries; this is done if the item is marked as draggable, this helps to be aware of the relationship of the item with its context, for example, when performing a drag and drop or doing a lasso selection and action can be more precise.

Some quirks and bugs about the ItemDelegate implementation have been fixed, such as correct parenting and feedback on performed actions, so with a MauiKit ItemDelegate, you get a draggable item, with feedback as a response on performing actions on touch or mouse input devices, and a predefined styling.

Pix, Index, and VVave using the ListBrowser and ItemDelegate.

The ListItemTemplate layout information in a row, in the following order:

LisItemTemplate layout

Now the initial item Icon/Image can be changed to any item by using the iconComponent property. Before you can add even more items to it by appending them.

The GridItemTemplate image now correctly follows and masks the image in a fit or fill mode. Also, it sees a nice fix to the label displayed under the icon/image, which previously had a loop bug due to the wrong calculation of its best size.

The ListBrowser and GridView implementations are now cleaner and perform better with touch or mouse-based interactions. This view templates have some other nice features such as adaptable cellWidth, lasso selection, predefined styling for spacing and margins, etc.

Dialogs

The default action buttons’ borders are now styled as other borders.

The dialog title is now shown in the header for more consistency.

The AboutDialog now uses KAboutData to get information about the application, such as authors, name, version, licensing, and libraries.

A bug causing the inline notification dialog to have a wrong size has been fixed.

VVave with inline notification

 

MauiApp

The main menu layout has been reordered, so the default About and Quit actions are always at the bottom.

Separator

A custom control for a separator has been added; this separator is composed of two lines, one darker and the other lighter, for better contrast.

Use a more cohesive look with the title in the title bar.

BackEnd

The backend utils for Mauikit have been cleaned up; this goes from the FileManagement utilities to the template data modeling and platform integration classes.

  • FMH functions have been moved from the header to an implementation file to clear all the unused warnings that were being generated.
  • Thumbnail previews for PDF and videos files were added thanks to KIO; this can be used by appending the prefix “thumbnail://”
  • A FileLoader class was added to the FileManagement utilities for asynchronous loading files; this is now being used to fetch files for Index, VVave, Pix, Shelf, Nota, and Cinema.
  • Android integration: removed old source code for contacts and moved to Communicator.
  • The MauiModel and MauiList have gained a few more useful methods to get the one or all items are out of the model.
  • The structure of the utility sources has been cleanup.

Apps

Currently, the Maui project maintains ten core applications to provide an essential experience: Index, VVave, Pix, Nota, Buho, Shelf, Station, Cinema, Communicator, and Sol, while some are at a stable state, some others are just recently entering a beta state.

This week’s progress includes many nice feature fixes to the current stable apps and upgrades to the beta ones.

Index

  • The file manager now has a more cohesive context menu for opening paths in split view and new tabs.
  • Now when making multiple selections and removing an item, the removed item is cleared from the selection bar instead of clearing all the selection.
  • The search functionality is now working again.
  • Now we have PDF and video thumbnail previews.
  • Items can be dragged over the tabs to switching between them and also between splits.
  • The sidebar’s new-files counter badge is back. It lets you know when a bookmarked folder has new content.

New files counter badge

VVave

  • VVave code has been cleaned up and improved for better performance. Now when clicking Play all or Append all actions, the tracks are copied to the playlist much more quickly. The player interface has been improved, and code redundancy has been removed.
  • A new Playlist controller in C++ has been added.
  • The AlbumsView for Artists and Albums have been improved not to be overloaded with not needed elements, same for the folders and playlists views.
  • The Folders view now has a filter field and can be switched to a list for better recognize folder path URLs
  • Now VVave has mpris2 support for Linux.

Pix

  • Better time date formats in delegates in the list view.
  • Fix build for macOS and Windows
  • Larger items in list view
  • Images in the viewer do not longer jump to the next or previous when resizing the window
  • The image viewer logic has been improved, clearing out small issues with the navigation

Nota

  • The Documents view now will group documents in their directories for easier browsing.

Buho

  • The Books view has been redesigned and the booklet views too. It nows lists all the “chapters” in a horizontal orientation.
  • The Notes view now switches from a grid to a list depending on the available space.
  • The new floating button now performs the expected action depending on the current view.
  • The notes cards now pick the right color for text and background.
  • Unfinished features with graphical items have been removed.

Cinema

The video player now has more features and has entered a beta state.

  • Videos view for browsing the video collection.
  • Tags view to browse tagged files.
  • Contextual actions for the collection, like sharing, copying, tagging, etc.
  • Video thumbnail previews.
  • The player view now has support for playlists, with a responsive UI.

Cinema responsive player view

Station

  • Correctly close inactive splits
  • Update application information

Sol

  • Tabs support.

Sol – Focus view and header

Shelf

  • Renamed from Library to Shelf
  • PDF thumbnail previews
  • Now using new MauiKit FileLoader

Shelf – documents view

 

What’s Next

  • Enable syncing of data and images on Pix, files in the Index file manager, and of contacts in Communicator.
  • Make Cinema and Sol initial beta release.

Our plans for 2021 are:

  • Fully utilize CMake.
  • Improve iOS support.
  • Improve data synchronization using NextCloud.
  • Improve performance.
  • Improve the UI cohesion on all supported platforms.
  • Move beta apps to stable.
  • Improve documentation.

The post Maui Weekly Report 6 appeared first on Nitrux — #YourNextOS.

We spent a lot of this week polishing up Plasma 5.20 and fixing bugs you’ve all found in the release. Thanks very much too all the people who have been testing it and reporting bugs! It’s very helpful. As a reminder, you can find distros shipping the beta here: https://community.kde.org/Plasma/Live_Images

New Features

Okular’s animated smooth scrolling feature can now be totally disabled in the app itself (me: Nate Graham)

Bugfixes & Performance Improvements

Kate’s File menu no longer ever loses menu items after closing a tab (Christoph Cullmann, Kate 20.08.2)

Okular’s editable forms are no longer mis-rendered when inertially scrolling (Kezi Olio, Okular 1.11.2)

When your scanner can almost but not quite fit a particular page size, Skanlite will now display the option to scan to that page size anyway (e.g. 215mm wide scan beds now give you the option to scan using the US Letter page size) (Kåre Särs, libksane 20.12)

The text of Elisa’s keyboard shortcuts are now translated properly (Nikunj Goyal, Elisa 20.12)

Clearing the clipboard history on Wayland no longer crashes Plasma (David Edmundson, Plasma 5.20)

Improved the Plasma SVG cache heuristics such that various things which might sometimes be invisible after upgrading Plasma now show up like they’re supposed to (Arjen Hiemstra, Plasma 5.20)

On Wayland, clicking on a Task Manager entry while that entry’s tooltip is visible no longer crashes Plasma (Vlad Zahorodnii, Plasma 5.20)

On Wayland, clicking on a Task Manager thumbnail now activates that window, as you would expect (Marco Martin, Plasma 5.20)

On Wayland, the window stacking order is now always correct (Vlad Zahorodnii, Plasma 5.20)

Auto-hidden panels now have an animated show/hide effect again (David Edmundson, Plasma 5.20)

The hover effect for titlebar buttons in GTK headerbar apps once again appears when it should (Mikhail Zolotukhin, Plasma 5.20

The names of the System Settings and Info Center apps are now translated properly (Alexander Potashev, Plasma 5.20)

The Plasma Emoji input window now always shows nice colorful emojis even if the distro’s fontconfig files are kind of messed up (Yunhe Guo, Plasma 5.20)

The little arrow in a System Settings list items for a top-level category will no longer appear if the category’s existence is obfuscated because it has only a single item, in which case System Settings automatically takes you to the child item (David Redondo, Plasma 5.20)

Shortcuts for switching to particular Activities now work again when set from the relevant System Settings page (David Edmundson, Plasma 5.20)

Plasma applet configuration windows now always display the correct sidebar appearance (David Redondo, Plasma 5.20)

On Wayland, context menus now always have shadows, as expected (Vlad Zahorodnii, Plasma 5.20)

Breeze buttons now display the correct colors when using certain non-default color schemes (Carson Black, Plasma 5.20)

Improved how KWin detects fully opaque windows, which will allow it to do less work by not rendering anything that’s entirely covered up by them (Aleix Pol Gonzalez, Plasma 5.21)

You’re no longer annoyingly asked whether you want to execute non-executable script files when you try to open them (Ahmad Samir, Frameworks 5.75)

It’s once again possible to enter shortcuts in the System Settings Shortcuts page that use the Alt Key when the Alt+something shortcut that you’re defining would otherwise trigger an action on the shortcut entry page itself! (David Edmundson, Frameworks 5.75)

Apps which show an “Are you sure you want to close multiple documents?” dialog when you quit while multiple documents are open will no longer do so if the app is quit as a part of the normal shutdown sequence when session saving is in use (Allen Sandfield Jensen, Frameworks 5.75)

User avatars in the Kickoff Application Launcher and the new System Settings Users page are no longer blurry (Carson Black, Frameworks 5.75)

Button icons on the login and lock screens are no longer mis-colored (Noah Davis, Frameworks 5.75)

User Interface Improvements

Pressing the Esc key in Gwenview while in full screen view now leaves full screen view the first time you press it, instead of first going back to browse mode (Michael Augaitis, Gwenview 20.12)

Elisa now has keyboard shortcuts to go back and forward by track while in the app itself (Ctrl+left arrow and Ctrl+right arrow) (Nikunj Goyal, Elisa 20.12)

Newly-generated thumbnail preview images will no longer longer embed mostly-transparent mimetype icons in the bottom-right corner, which were super confusing (Stefan Brüns, Dolphin 20.12)

Scrollbars in GTK apps using the Breeze GTK theme are now the correct width (Carson Black, Plasma 5.20)

After changing the charge limit on your battery, you’re only shown a message saying, “You may need to re-connect your charger” if it’s not already plugged in (Kai Uwe Broulik, Plasma 5.20)

System Settings and Info Center now have a “Report Bug…” menu item in their hamburger menus (David Redondo, Plasma 5.20)

The System Activity window (the thing that appears when you press Ctrl+Esc) now has correct margins (me: Nate Graham, Plasma 5.20)

KRunner’s settings page now uses more accurate text for its new positioning modes feature (me: Ne Graham, Plasma 5.20)

Info Center now has a fancy new Network Interfaces page (Carl Schwan, Plasma 5.21)

How You Can Help

Have a look at https://community.kde.org/Get_Involved to discover ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite!

Finally, consider making a tax-deductible donation to the KDE e.V. foundation.

Cross-compilation of Qt projects is now supported in the Qt Visual Studio Tools. This is possible due to the integration of Qt/MSBuild and the Linux development VS workload. In this post we will show how to use this feature to create an embedded application with Qt Quick in Visual Studio.

We are happy to announce the release of the Qt Visual Studio Tools version 2.6.0. Installation packages are now available at the Visual Studio Marketplace.

Wednesday

23 September, 2020

Somebody pointed me to a research article about how many app developers fail to comply with the GDPR and data requests in general.

The sender suggested that I could use it in marketing for Nextcloud.

I appreciate such help, obviously, and often such articles are interesting. This one - I read it for a while but honestly, while I think it is good this is researched and attention is paid for it, I neither find the results very surprising NOR that horrible.

What, a privacy advocate NOT deeply upset at bad privacy practices?

Sir, yes, sir. You see, while the letter of the law is important, I think that intentions also are extremely important. Let me explain.

Not all GDPR violations are made equal

If you or your small business develops an app or runs a website to sell a product and you simply and honestly try to do a decent job while being a decent person, the GDPR is a big burden. Yes, the GDPR is good, giving people important rights. But if you run a mailing list on your local pottery sales website, with no intention other than to inform your prospective customers and followers of what you're up to, it can be a burden to have people send you GDPR takedown and 'delete me' requests instead of just having them, you know - unsubscribe via the link under your newsletter!

The goal of the GDPR, and of my personal privacy concerns, isn't at all related to such a business. If anything, their additional hardship (and we at Nextcloud have this issue too) is at best a by product of the goal. That byproduct isn't all bad - we all make mistakes, and being more aware of privacy is good, even for small businesses. The GDPR has forced many small businesses to re-think how they deal with private data, and that isn't a bad thing at all. But it isn't the main benefit or goal of the GDPR in my eyes. There are big businesses who totally COULD do better but never bothered, and now the GDPR forces them to get their act together. While that's a real good thing, even THAT is not, in my opinion, what the GDPR is about.

Privacy violation as a business

You see, there are businesses who don't violate privacy of people by accident. Or even because it is convenient. There are businesses who do it as their core business model. You know who I'm talking about - Facebook, Google. To a lesser but still serious degree - Microsoft and yes, even Apple, though you can argue they are perhaps in the "side hustle" rather than "it's their primary revenue stream" category.

For these organizations, gathering your private data is their life blood. They exploit it in many ways - some sell it, which is in my opinion definitely among the most egregious 'options'. Others, like Google and Facebook, hoard but also aggressively protect your data - they don't want to leak it too much, they want to monetize it themselves! Of course, in the process of that, they often leak it anyway - think Cambridge Analytica - that was in no way an incident, hundreds of apps get your private data via Google, Facebook, Microsoft and others. But by and large, they want to keep that data to themselves so they can use it to offer services - targeted ads. Which in turn, of course, get abused sometimes too.

My issue with this business model, even without the outright sale of data, is two-fold.

Ads work better than you think

First, in principle - while people might feel ads don't effect them, there is a reason companies pay for them. They DO effect your behavior. Maybe not as much or in the way marketing departments think or hope, but the effect exists.

How bad is that? Depends, I guess. To some degree, it is of course entirely legitimate that companies have a way to present their product to people. But modern targeting does more, including allowing companies to charge specific people different prices, and of course a wide arrange of sometimes nasty psychological tricks is used. The example Facebook once gave to potential advertisers, of targeting an insecure youth "at their most vulnerable" with an ad is... rather disgusting.

This gets worse when we're not just talking about product ads but political ads, either from political countries or, of course, from foreign non-democratic adversaries trying to influence our freedoms in a rather direct and dangerous way. And again - this is more effective than most people realize or are willing to admit and has swayed elections already, making is all less free.

Centralization is bad

Second, there is simply a HUGE issue with all-our-eggs in one basket. Especial when that basket is in a foreign country and not protected by privacy and security laws compatible with those in your own country. Having a single point of failure, how well protected - is just not smart. Things WILL fail, always. Better have slightly more breaches that each are just a single provider, than one breach of all private data of everyone in a country...

And that's not even talking about the fact that this data helps these companies get incredibly huge and then allows them to suppress or kill competition (or just buy it) - think Amazon, Microsoft. These tech molochs are just plain bad because of many reasons. They are anti-competitive, which raises prices, decreases choice, and the much lower innovation-per-dollar they produce is of course a worse deal for society too. They are too easy to control by law enforcement and censorship, impacting our freedoms - even when they're not 'foreign' to you. Yes, it is harder to censor 50000 private servers than one Google server farm!

Triggered

 So, as you notice, this question triggered me. Not all privacy violations are equal. Intentions matter. As does market power. And the GDPR is not a golden bullet. It has downsides - compliance is often easier for big companies than small ones, a serious issue.

Luckily, our judicial system tends to look at the intentions behind law, and I would expect a judge to fine an organization heavier for truly bad business models than for honest mistakes. I hope I'm not too optimistic here.

From my side, I don't want to bang on people's head for mistakes. I want to attack and challenge bad business models and bad intentions. A local, small app maker who fails to respond quickly enough to GDPR requests - not my target. Facebook - yes.

And by the way. Maybe it doesn't need to be said to most of you, dear readers, but of course - our open source world is, I still believe, a huge part of solving this problem. KDE, openSUSE and other Linuxes and desktops - and of course Nextcloud, Mastodon, Matrix and other decentralized and distributed and self-hosted platforms. We have ways to go, but we're making progress!


As I concluded to the person who triggered me - I know, this is far too long a reply to what they said


But it triggered me ;-)


Best reply over twitter, (twitter.com/jospoortvliet) or so, this awful Google platform makes commenting nearly impossible. And I know, the irony, replying on twitter, and I still have not moved away from blogger.com... Some day, some day. When I find time.

Thanks to the feedback & patches provided by others, I found a bit more motivation to take a look at the small things that seems to be odd in KTextEditor.

Interesting enough, if you once notice a small detail (like a dead pixel on your display you suddenly find after years of use), it really sticks out like a sore thumb…

Here two small things that caught my interest this week.

KTextEditor border widget painting

If you have some theme like “Vim Dark” with border background color equal to the text background color, strange stuff happens.

See the following screenshot:

You can’t actually tell: Is this the folding marker column or is all my text indented by one or two spaces? There is no visual hint for this.

Funny enough, there is some visual hint to show that on the left side you might have some marks, if you turn that on in addition:

But then you see the next strange stuff: this separator is only painted until the last line of text is reached, strange, too. I think this behavior was like this since we implemented that parts of the rendering.

I never noticed that until I tried out to use the new nifty ayu theme as my daily theme (see the themes gallery).

Now, I scratched that itch in this merge request.

The current state with Vim Dark looks now like this (will be in Frameworks 5.75):

The separator got just moved between the border widget and the text and the painting got fixed to span the complete visible widget height.

I think this makes both for a better separation between border and text and for a visually better appearance.

Do you need to think about if the text is indented in this screenshot? I don’t think so.

Especially that the old separator got not even drawn for the region below the last line was kind of astonishing, I must confess, that slipped my mind for years until I focused once on that ;=)

You have noticed that the Vim Dark colors did change a bit compared to the above two screenshots? That’s thanks to Nibaldo González scratching an itch, making the colors more consistent with real Vim. Thanks for that!

Just take a look at that perfectly done merge request, you can judge the changes just by taking a look at the before/after screenshots. Awesome!

KTextEditor initial input lag

Have you ever noticed that for the first view you type something in, there is a small lag after some keystrokes? Depending on your machine, it might even be not that short. And after that initial lag, all is fine.

I noticed that lag already in the past but lost interest to take a look into it, as it just happens once for each start and use of e.g. Kate.

Now that I play around more with short KWrite open, test & close sessions for debugging other stuff, I got more interested again.

It was easy to trace back: on-the-fly spellchecking is the reason for this.

Once at the start, you will initially need to load both the spellchecking dictionary and the trigrams.

Over a lot of different layers, this is triggered after the first few characters are typed (or any other text manipulation).

Given it is non-trivial to remove this lag by moving this to a thread or by other complex solutions I thought about, I went for a quick’n’dirty fix: just do that once on startup if we have on-the-fly spellchecking enabled.

Some fractions of a second on startup more is much nicer UI wise than a short hang during your initial typing that kills your flow.

With this change, Frameworks 5.75 will have lag free input even directly after the startup of your KTextEditor based application.

And for people that have no on-the-fly spellchecking enabled, no extra penalty is there.

Done ;) For now…

I hope this small improvements make some people happy (or at least don’t annoy them).

If you happen to see such small issues and you can code, please think about contributing some patch to fix them.

Even fixing such small things can have a large impact on the usability and perception of our stuff.

Help is always welcome!

Since the initial port of PySide to Qt5 (a.k.a PySide2), the interaction with QML was on the list of features we wanted to fully support in our set of bindings, due to the popularity of QML.

With the first official release 5.12, we had cover many use cases for the QML and Python interaction, but also we left out a couple of use cases that were really required by our community. Now that we are developing new features and improvements for Qt6, we wanted to address most of them.

Here you can find a summary of the features that we have done so far for the planned Qt for Python 6.0 release.

Memory bugs are tricky. Leaks have a clear impact on performance, and quickly become hard to spot when heap allocated objects move too much. Memory access bugs, on the other hand, make your program crash right away, if you’re lucky. In less desirable cases, they may end up corrupting random objects on the heap, and only end up in a crash much later. Or even worse, leading to undetected undefined behaviours or wrong computations.

This is the reason why there are a number of standalone tools (e.g. valgrind, Dr.Memory), as well as compiler extensions (e.g. AddressSanitizer, MemorySanitizer, LeakSanitizer) to help with memory bug detection.

On Windows, and especially using Qt, things are a bit harder, as valgrind is not an option and Dr.Memory often crashes with Qt applications. Unless you use WSL, this only leaves compiler tools on the table.

Memory Sanitizers on Windows

First of all, what are our choices when it comes to using memory sanitizers on Windows?

There are two options:

  1. with Visual Studio’s cl compiler
  2. with LLVM’s clang/clang-cl compilers (also available through Visual Studio)
    • {x86,amd64}/Release builds only – AddressSanitizer only

So using AddressSanitizer (from now on ASAN) is the only viable option for memory bug detection with memory sanitizers on Windows. Also, since the support for the cl compiler is still incomplete, in this post we will be using clang.

Furthermore, we will be using Visual Studios’s bundled clang to make it possible to generate Visual Studio solutions. If you’re using your own clang installation, you should update the following paths accordingly. You can find Visual Studio 2019’s clang in the following directories:

  • For x86: %ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\bin
  • For x64: %ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\x64\bin

Note that you will need to add the right directory manually to the PATH when using the command line, as there is no vcvars script available for clang tools.

From now on I’m going to assume for all paths that we’re using Visual Studio 2019 Professional and we’re building 64 bit applications.

Compile an executable with the static C++ runtime (/MT)

If you build and link in one go, it is enough to compile with -fsanitize=address

clang-cl -fsanitize=address main.cpp

When doing compilation and linking in separate steps, we need an extra step to provide the ASAN runtime explicitly.

clang-cl -fsanitize=address -c main.cpp -o main.o
# Call vcvars64 here so lld-link will be able to link all the default libraries
lld-link main.o -libpath:"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\x64\lib\clang\10.0.0\lib\windows" ^
    -wholearchive:clang_rt.asan-x86_64.lib -wholearchive:clang_rt.asan_cxx-x86_64.lib

The linker will implicitly link the program against the static CRT (/MT) and with the static version of clang’s ASAN runtime. Note the use of -wholearchive to force the compiler to include all the symbols from the library, avoiding optimizations.

If the program consumes a library which is also being sanitized, then said library (which should be linked against the dynamic CRT with /MD) should be linked against clang_rt.asan_dll_thunk-x86_64.lib. In this way, the library (or libraries) will use the shadow memory of the statically linked ASAN runtime in the executable.

Compile an executable with the dynamic C++ runtime (/MD)

Again, it is easy to compile and link in one go:

clang-cl -fsanitize=address /MD main.cpp

But now the executable should use a different ASAN runtime when linked:

clang-cl -fsanitize=address -c main.cpp -o main.o
# Call vcvars64 here so all the default libraries are added to lld-link
lld-link main.o -libpath:"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\x64\lib\clang\10.0.0\lib\windows" ^
    clang_rt.asan_dynamic-x86_64.lib -wholearchive:clang_rt.asan_dynamic_runtime_thunk-x86_64.lib

Note that only clang_rt.asan_dynamic_runtime_thunk-x86_64.lib needs the -wholearchive flag here.

All the included dlls that are also sanitized (which should always be using the dynamic CRT) should be linked against the same ASAN runtime libraries as the executable.

Since clang_rt.asan_dynamic-x86_64.lib is an import lib pointing to clang_rt.asan_dynamic-x86_64.dll, when running a sanitized executable (or loading a sanitized lib) its folder should be in the PATH. You can find the dll alongside the .lib in %ProgramFiles(x86)%\Microsoft Visual Studio\2019\Professional\VC\Tools\Llvm\x64\lib\clang\10.0.0\lib\windows.

Using ASAN with CMake

If you want to use ninja or any other generator other than Visual Studio, just point CMake to your clang-cl installation and add the necessary flags to your targets. Adjust your flags for plain clang if you don’t need or don’t care about clang-cl.

add_executable(exec main.cpp)
target_compile_options(exec PRIVATE -fsanitize=address) # /MD will be used implicitly
target_link_directories(exec PRIVATE "${ENV:PROGRAMFILES(X86)}/Microsoft Visual Studio/2019/Professional/VC/Tools/Llvm/x64/lib/clang/10.0.0/lib/windows")
target_link_libraries(exec PRIVATE clang_rt.asan_dynamic-x86_64 clang_rt.asan_dynamic_runtime_thunk-x86_64)
target_link_options(exec PRIVATE /wholearchive:clang_rt.asan_dynamic_runtime_thunk-x86_64.lib)

CMake will always need to be invoked with -DCMAKE_BUILD_TYPE=Release otherwise the compilation will fail.

To generate a Visual Studio solution, you need to pass a few extra arguments to CMake:

  • Generate a Visual Studio solution: -G "Visual Studio 16 2019"
  • Choose between 32 or 64 bit target: -A {Win32,x64}
  • Use the clang toolkit: -T ClangCL

Or, if you are using Visual Studio Code just select the right entry from the kit list (e.g. Clang 10.0.0 for MSVC with Visual Studio Professional 2019 Release (amd64)).

Conclusions

Using tools to track down memory bugs helps saving time and effort, especially on complex projects. On Windows, the available tooling is limited, and a step by step documentation on how to use what’s available may be hard to come by. With this blog post, it will be hopefully easier for you to leverage the AddressSanitizer on Windows and keep memory bugs in your projects under control.

 

If you’d like to learn more about the tooling available for C++ developers working with Microsoft Windows on the desktop, you might be interested in our Debugging and Profiling C++ Applications on Windows training.

 

About KDAB

If you like this blog and want to read similar articles, consider subscribing via our RSS feed.

Subscribe to KDAB TV for similar informative short video content.

KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us.

The post How to Build C++ Projects with the Address Sanitizer on Windows appeared first on KDAB.

Tuesday

22 September, 2020

The summer has come and gone since the 4.3 release, but we have not been sitting still. We had four Summer of Code Students this year, each of which completed their project. One of these projects has already made it into 4.4: The SeExpr fill layers! And that’s not the only new fill layer type… And fill layers now have on-canvas preview when you created them. And there’s a new plugin that helps when using Krita together with Godot. And there are new options for the brush engines and, of course, a ton of bugfixes! The full release notes bring you all the details!

So, today, we’re releasing Krita 4.4.0 beta 1: in two weeks we will release the final version. Please help improve Krita by testing this beta!

 

Download

Windows

If you’re using the portable zip files, just open the zip file in Explorer and drag the folder somewhere convenient, then double-click on the krita icon in the folder. This will not impact an installed version of Krita, though it will share your settings and custom resources with your regular installed version of Krita. For reporting crashes, also get the debug symbols folder.

Linux

(If, for some reason, Firefox thinks it needs to load this as text: to download, right-click on the link.)

OSX

Note: the gmic-qt is not available on OSX.

Android

This beta will not be available for Android. However, we are currently working on some significant fixes for saving and loading files on Android, and we hope to have these included in the final version of Krita 4.4 for Android, so sit tight!

Source code

md5sum

For all downloads:

Support Krita

Krita is a free and open source project. Please consider supporting the project with donations or by buying training videos! With your support, we can keep the core team working on Krita full-time.

The post First beta out for Krita 4.4 appeared first on Krita.

Over the past year I’ve been bumping into the Felgo crew at various Qt events. They take Qt to the next level. It all started as a game development framework for Qt, but has turned into a powerful app development framework taking a lot of the rough corners of Qt, and extending the tooling with a powerful live reloader at the same time.

https://qmlbook.github.io/_images/felgo-logo.png

To showcase how the Felgo SDK fits into the bigger picture, and how much it actually helps creating apps, we agreed to extend the QML Book with a Felgo chapter. The chapter is built around a messaging app and showcases the whole UI creation from initial skeleton to working app.

https://qmlbook.github.io/_images/messaging-stage-2.png

We also cover a bunch of other things such as how to get started, the QML Live reloader, as well as some more advanced topics such as native dialogs, simplified networking and the JsonListModel.

Big thanks goes out to Felgo for supporting this work and helping to make QML Book better.