Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7755953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:41:42+00:00 2026-06-01T12:41:42+00:00

Issue comes up when i try to unload plugin that is loaded and load

  • 0

Issue comes up when i try to unload plugin that is loaded and load a new one. So both plugins are loaded correctly, but when switching them (first is loaded, second is unloaded and viceversa) my app crashes. What can be the problem ?

First what i’m doing i try to unload a plugin stored into a QList of QPluginLoader, then i check (depdend on id(integer number) passed from a special menu for loading plugins ) what plugin to load. First load is well (first plugin is loaded, nothing at this point to unload) , second load (unload first plugin, second is loaded), at third load i get crash

void MainWindow::loadPluginUsingId (int plugin_id) {

        foreach (QPluginLoader* pluginLoader, plugins) {        
                 pluginLoader->unload();
                 delete pluginLoader;
               }

         switch (plugin_id) {

           case 0 : {

            foreach (QString fileName, pluginDir.entryList(QDir::Files)) {
               if (fileName == fullNameOfPlugins.value(plugin_id)) {
                     QPluginLoader* pluginLoader = new QPluginLoader(pluginDir.absoluteFilePath(fileName));
                     QObject *plugin = pluginLoader->instance();

                     IndicatorInterface *indicator = qobject_cast<IndicatorInterface*>(plugin);
                     indicator->initIndicator();
                     plugins.append(pluginLoader);
                 }
             }
         }

         break;
          case 1 : {

             foreach (QString fileName, pluginDir.entryList(QDir::Files)) {

                 if (fileName == fullNameOfPlugins.value(plugin_id)) {

                       QPluginLoader* pluginLoader = new          QPluginLoader(pluginDir.absoluteFilePath(fileName));
                       QObject* plugin = pluginLoader->instance();
                       PlotterInterface *plotter = qobject_cast<PlotterInterface*>(plugin);
                       plotter->initPlotter();
                       plugins.append(pluginLoader);
                     }
                 }
            }
         break;
           default :
               break;
           }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:41:43+00:00Added an answer on June 1, 2026 at 12:41 pm
        foreach (QPluginLoader* pluginLoader, plugins) {        
                 pluginLoader->unload();
                 delete pluginLoader; // this could be your problem
               }
    

    You need to remove the dangling pointer from the plugins list. Failure to do that would result in what you’re describing.

    Try this:

    while (!plugins.isEmpty()) {        
       QPluginLoader* pluginLoader = plugins.takeFirst();
       pluginLoader->unload();
       delete pluginLoader;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The sample program that comes with the Extension Library works just fine, but when
There is a well known issue when it comes to using .NET value types
The current issue im facing is comes from the following scenario. I have a
I have an issue using jquerys selectors when it comes to a page I
I have a strange issue, when it comes to parsing XML with NSXMLParser on
I have an odd issue. The first time a visitor comes to the site
After being unable to solve this issue , I decided to try to implement
I am facing this issue but unable to resolve. My problem goes like this:
NOTE: ORIGINAL PROBLEM WAS FIXED, but there's still some issues using the plugin on
I have changes the code but the issue is still there CandidateResumeInfo candidateResumeInfo =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.